Simple Prompt

RichGags

Registered User.
Local time
Today, 15:17
Joined
Jun 30, 2003
Messages
39
Sorry if this has been discussed here before, But I could not find it.

Ive created a button on my form "Print Contract". When I press it, I want access to prompt the user for a "Booking#", which is the name of the field with "Booking#" in it. Right now, I have:

Private Sub Command320_Click()
DoCmd.OpenReport "JDContract", acViewNormal, , "[BOOKING#] = " & Me.[BOOKING#]

End Sub

But that print the currect record selected. Thanks in advance.
 
Made some progress, almost there. Ive created a query called JDContract, and have the button do this now:

Private Sub Command320_Click()
DoCmd.OpenQuery "JDContract", acViewPreview

End Sub

Then I just hit the print button on top. But how would I do it if I dont want to preview and just have it go to the printer?
 
???

Forgive me, but I am uncertain why you are using an openquery now instead of openreport. The query that sources your report should have had the [Please enter the booking #] in the criteria for the booking# field of the query that is the recordsource of the report. That would have prompted the question that you wanted. To print directly the code should have then been:

DoCmd.OpenReport "JDContract", acViewNormal
 

Users who are viewing this thread

Back
Top Bottom