Close form after report opens?

R

Randy

I have a form with a txbox to enter the date and a cmd button which opens a
report. I would like the form to automatically close when the report opens.
When the user closes the report I would like the form to be
closed..Thanks...Randal
 
F

fredg

I have a form with a txbox to enter the date and a cmd button which opens a
report. I would like the form to automatically close when the report opens.
When the user closes the report I would like the form to be
closed..Thanks...Randal

Leave the form open while the report runs.
Code the Report Close event:

DoCmd.Close acForm, "FormName"

When the report closes it will close the form.

Pehaps a better method would be to let the report itself open the
form.
In addition to coding the report's Close event, as above, do the
following.

Code the Report Open Event:
DoCmd.OpenForm "FormName", , , , , acDialog

Code that command button on the form:
Me.Visible = False

Now all you need do is open the report (not the form).
When the report opens, it will open the form.
After the date has been entered in the form click the command button.
The form will become not visible, and the report will display.
When you close the report, it will also close the form.
 
R

Randy

Perfect. That was easy, Thanks a lot..
fredg said:
Leave the form open while the report runs.
Code the Report Close event:

DoCmd.Close acForm, "FormName"

When the report closes it will close the form.

Pehaps a better method would be to let the report itself open the
form.
In addition to coding the report's Close event, as above, do the
following.

Code the Report Open Event:
DoCmd.OpenForm "FormName", , , , , acDialog

Code that command button on the form:
Me.Visible = False

Now all you need do is open the report (not the form).
When the report opens, it will open the form.
After the date has been entered in the form click the command button.
The form will become not visible, and the report will display.
When you close the report, it will also close the form.
 
Top