Export Excel file but first ask for date range (1 Viewer)

hardhitter06

Registered User.
Local time
Today, 11:24
Joined
Dec 21, 2006
Messages
600
Hi All,

I've set up a command button to export my query to an excel file but I'm not sure how I can ask for the date range before the file is exported?

I have this for code:

Code:
Private Sub Command5_Click()
DoCmd.OutputTo acOutputQuery, "QryMaster", acFormatXLS
End Sub


And I have this code for my 'EntryDate' field in my query:

Code:
Between [Enter the Start Date] And [Enter the End Date]

How do I merge the two together?

Thank you!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:24
Joined
Aug 30, 2003
Messages
36,133
I use form controls for the user to enter the dates. The OutputTo would use them.
 

hardhitter06

Registered User.
Local time
Today, 11:24
Joined
Dec 21, 2006
Messages
600
Do you mean having fields to enter in dates and then hit the command button?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:24
Joined
Aug 30, 2003
Messages
36,133
Yes; I feel I have more control that way. I can validate the dates, etc.
 

Users who are viewing this thread

Top Bottom