Hi, as this is my first foray in the world of Forums please be gentle as I expect there is a very simple answer!!
I have a number of Excel extracts to run all based on the same start and completion dates. My idea was to use a InputBox to collect the dates, open the query which contained all the fields needed, apply a filter against one of the fields using "Between And", run a macro to export the Excel file, clear the filter and repeat applying the date filter to the next field.
I've put together the following code:
Dim dtStart_Date As Date
Dim dtFinish_Date As Date
dtStart_Date = InputBox("Enter Report Start Date", , , 3600, 3600)
dtFinish_Date = InputBox("Enter Report Finish Date", , , 3600, 3600)
DoCmd.OpenQuery "Data Entry", , acViewNormal
DoCmd.ApplyFilter , "([Data Entry].fldPRS_Received) between dtStart_Date and dtFinish_Date"
the date don't seem to get passed to the filter and the result is an empty data sheet!
Any ideas gratefully excepted.
Buttons
I have a number of Excel extracts to run all based on the same start and completion dates. My idea was to use a InputBox to collect the dates, open the query which contained all the fields needed, apply a filter against one of the fields using "Between And", run a macro to export the Excel file, clear the filter and repeat applying the date filter to the next field.
I've put together the following code:
Dim dtStart_Date As Date
Dim dtFinish_Date As Date
dtStart_Date = InputBox("Enter Report Start Date", , , 3600, 3600)
dtFinish_Date = InputBox("Enter Report Finish Date", , , 3600, 3600)
DoCmd.OpenQuery "Data Entry", , acViewNormal
DoCmd.ApplyFilter , "([Data Entry].fldPRS_Received) between dtStart_Date and dtFinish_Date"
the date don't seem to get passed to the filter and the result is an empty data sheet!
Any ideas gratefully excepted.
Buttons