On 2 Jan 2005 16:09:53 -0800,
pe*******@physics.brown.edu wrote:
I am trying to set up an unbound form to enter report criteria.
I've followed the MS Office Assistance document: "Create a form to
enter report criteria" which describes how to enter data (such as
dates) in a text box. This procedure works fine. However, I also need
to enter data from a combo box and I cannot get this to work. On my
form I've created an unbound combo box named "Name". In the query bound
to the report I've entered the criterion:
[Forms]![Name of unbound form]![Name]
However, this value does not seem to pass to the query and the report.
If I run the query by itself and enter the criteria (date and name) in
Parameter Values dialog boxes, it works.
Thanks for any help you can offer.
The below combo box uses a CompanyID field to pass the criteria.
You'll need to adapt it to match your query criteria field names AND
DATATYPE.
Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set the Column Width property to 0";1"
Add a Command Button to the form.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In the Report's Record Source [CompanyID] field criteria line write:
forms!ParamForm!FindCompany
Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog
Code the report's Close event:
DoCmd.Close acForm, "ParamForm"
When ready to run the report, open the report.
The form will open and wait for the selection of the Company.
Click the command button and then report will run.
When the report closes, it will close the form.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.