Custom Forms for Dialouge Box?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

can anyone point me in the direction of a tutorial that tells me how to use
a custom form as a dialogue box to run a report....

e.g. - i want to have a form with a combo list of names, then when the name
is selected it opens up a report filtered by that name.

many thanks,

Neil
 
Hi there,

can anyone point me in the direction of a tutorial that tells me how to use
a custom form as a dialogue box to run a report....

e.g. - i want to have a form with a combo list of names, then when the name
is selected it opens up a report filtered by that name.

many thanks,

Neil

The below refers to CompanyID and Company Name.
Change it as required for your own needs.

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'.

Create a query with all the fields wanted in your report.
Make this query the report's record source.

In the Query's[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.
 
Back
Top