Pass Variable to SQL parameter

Steve887

New member
Local time
Tomorrow, 07:00
Joined
Mar 24, 2008
Messages
9
I have a report running on two queries. Each query has a where clause with the same parameter:
Code:
WHERE bookings.bookingid=[latestbooking]

What I've already done is to code when a user presses the confirm button, to write the most recent booking id to a variable. What I want is this variable to be passed straight to the parameter so the enter parameter message box doesn't come up and the report opens to the correct record.

What I was thinking to do is:
Code:
latestbooking = DMax("bookingid", "bookings")
DoCmd.OpenReport "Booking Confirmation", acViewPreview, , latestbooking

But the parameter box still opens. What's the best way to do this?
 

Users who are viewing this thread

Back
Top Bottom