View Full Version : Controlling DoCmd.Close


Mapes
11-22-2000, 01:19 PM
Below I have tried to describe my problem and two futile attempts to fix it:


Form_1: User enters criteria. User clicks on rpt button.

Form_2: Displays: Processing Please Wait

RptPreview: Displays report results

Problem: When report is closed, Form_2 is still open.
- - - - - - - - - - - - - - -

Attempt 1:
DoCmd.Close
DoCmd.OpenReport "rptname", acViewPreview...

Pb w/attempt 1 This closes the form all right but there is a 20 second time gap before the report preview finishes processing and displays.

- - - - - - - - - - - - - -
Attempt2:
DoCmd.OpenReport, "rptname", acViewPreview...
DoCmd.Close


Pb w/attempt2 The rpt preview closes instead of the form_2.
****************************************
Any suggestions are greatly appreciated. Thanks.

Talismanic
11-22-2000, 01:43 PM
There may be a better way to do this but you could put this in your close event of your report:

DoCmd.Close acForm, "Form_2"

This will close Form_2 when the report is closed.

kaspi
11-22-2000, 06:00 PM
Try this before trying to close the report:
DoCmd.SelectObject acReport, "rptName"

kaspi
11-22-2000, 06:03 PM
OOps!
Select your form instead of your report!
DoCmd.SelectObject acForm, "frmName"

Mapes
11-27-2000, 08:20 AM
Thanks Talismanic your solution worked perfectly. Kaspi I was not able to get your suggestion to work, but thanks anyway.