If you are going to enter it manually, make it a parameter query and when
the report runs it will ask for the parameter. Will work for multiple
parameters but will pop up a dialog asking for each in turn.
Or you could build a dialog on which you enter the value/s, hide the form
only when showing the report, don't unload it, and have your report query
reference the controls on the dialog to get the value. This solution is good
if you have multiple parameters.
Then in the close event of the report check to see if the dialog is open,
which it should be, then close it.
If there is to be no human entering of the parameter, use a constructed
'where' statement to filter the report.
There are other ways of doing this but this is the method I see used often.
I rarely use it myself as I have built a reporting module that handles
pre-processing, filter dialogs and much more.
Jeff
> Anyone know how to pass a parameter to a query via a report in Access
> 2003?
cjb_kjb - 30 Jan 2006 23:23 GMT
I agree the easiest way is to use a where clause to filter the report.
(have the report's filter on property set to yes)
This is best done though if you are using
Docmd.openreport..... to open the report
Alternatively - if using Access2003 you can pass openargs now to a
report so in the on open event you can use these to modify the report's
recordsource. You can also modify the recordsource in the on open
event by referencing other objects (eg form, table ....) for criteria.