I have a report which is fired from a button, calls a macro, which calls a query. The query has a condition asks the user for parameters. They are fromDate and toDate. The conditional part of the query is:
........WHERE (((TBL_Support_Call.DateTime)>=[Enter From Date] And (TBL_Support_Call.DateTime)<=[Enter To Date]))
ORDER BY TBL_Support_Call.[DateTime] DESC;
This all works fine however when I File > export.....to Excel I get asked for the parameters again. This is very annoying how can I stop this?
Just create yourself a form that has the criteria you want (both dates, maybe more), have an OK button on it to call up your report. Then your queries can refer to Forms![YouDialogBoxFormName]![YourFromDateControlName] for example, instead of [Enter From Date]
The other fantastic thing about doing this is that even the developer (you) won't have to worry about entering dates all the time just to see the layout of the report.
Another one is that many reports can use the same dialog box.