Usually, to limit a report this way, you would open a pop-up form first.
Select the option you want, and pass the option to the report.
To pass the selection, there are a couple of options.
1) Hide the form instead of closing it. The selection will now be available
in the query or the report as a parameter. To refer to the selection, use
the path to the control similar to Forms!frmMyForm!txtMyTextbox. Close the
form when you close the report.
To open the form to be used this way, open it in the report's Open event
using the acDialog Window Mode argument in the DoCmd.OpenForm command. This
will cause the report's code to pause until you close or hide
(Visible=False) the form.
2) Open the report from the form. In the DoCmd.OpenReport call pass the
parameter as the WHERE argument of the command.
--
Wayne Morgan
MS Access MVP
Nasos said:
Thanks that works ok, but I have a further problem with the same report,
the recordsource for the header/footer section is a table which contains one
record for each report available. How can I have a query which will select
only the one reecord which I need for the current report using it name? The
primary key of the table is the name of the report "