pop-up form before opening a report

J

Jerry Crosby

I've designed a simple form with two unbound fields, BeginDate and EndDate.
I want to use this form as a pop-up before a report is opened so the user
can specify what date range to use in the report.

From the main menu I have a command button that says to open the report.
What I want to happen is for that "date grabber" form to open first, wait
for a response, and when it is closed the report would be visible.

The command button on the main menu is set to open the report.

I have the OnOpen setting on the report set to open the date grabber form.

The date grabber form is set as pop-up (yes) and modal (yes).

What happens is the date grabber form opens as expected, but when it is
closed the report isn't open.

What did I miss?

Jerry
 
F

fredg

I've designed a simple form with two unbound fields, BeginDate and EndDate.
I want to use this form as a pop-up before a report is opened so the user
can specify what date range to use in the report.

From the main menu I have a command button that says to open the report.
What I want to happen is for that "date grabber" form to open first, wait
for a response, and when it is closed the report would be visible.

The command button on the main menu is set to open the report.

I have the OnOpen setting on the report set to open the date grabber form.

The date grabber form is set as pop-up (yes) and modal (yes).

What happens is the date grabber form opens as expected, but when it is
closed the report isn't open.

What did I miss?

Jerry

If the pop-up form closes then it is no longer available for use by
the report.
Here is a method to use a form for parameter entry. Adapt it to your
situation.

Create an unbound form. Add 2 Text Controls.
Name one StartDate and the other EndDate.

Add a command button.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.
No need to set it's Pop-up or Modal properties to Yes.

In the query that is the Report's record source, in it's Date field's
criteria line, 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 display
and wait for the entry of the dates. Click the command button and the
report will run without need for any further parameter entries. When
the report closes, it will close the form.
 
Top