T
TraciAnn
I am trying to create a parameter form to run a report using these
instructions from a previous post:
When I run the report I get the error: Microsoft Office Access can't find
the object "DoCmd."
Is this a built in macro that was eliminated in the '07 release?
------
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 it's Column Count property to 2.
Set the Column Width property to 0";1"
Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"
Add a Command Button to the form.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In the Query, (the Report's Record Source) [CompanyID] field criteria
line write:
forms!ParamForm!FindCompany
As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate
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 and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
To display the date parameters in the report, add an unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and " &
[forms!ParamForm!EndDate]
The text, i.e. forms!Paramform!StartDate & forms!ParamForm!EndDate,
must be identical to the text in the query. Include the brackets as
shown.
instructions from a previous post:
When I run the report I get the error: Microsoft Office Access can't find
the object "DoCmd."
Is this a built in macro that was eliminated in the '07 release?
------
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 it's Column Count property to 2.
Set the Column Width property to 0";1"
Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"
Add a Command Button to the form.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In the Query, (the Report's Record Source) [CompanyID] field criteria
line write:
forms!ParamForm!FindCompany
As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate
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 and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
To display the date parameters in the report, add an unbound text
control to the Report Header.
Set it's control source to:
="For sales between " & [forms!Paramform!StartDate] & " and " &
[forms!ParamForm!EndDate]
The text, i.e. forms!Paramform!StartDate & forms!ParamForm!EndDate,
must be identical to the text in the query. Include the brackets as
shown.