Controlling DoCmd.Close

Mapes

Registered User.
Local time
Today, 03:59
Joined
Nov 14, 2000
Messages
11
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.
 
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.
 
Try this before trying to close the report:
DoCmd.SelectObject acReport, "rptName"
 
OOps!
Select your form instead of your report!
DoCmd.SelectObject acForm, "frmName"
 
Thanks Talismanic your solution worked perfectly. Kaspi I was not able to get your suggestion to work, but thanks anyway.
 

Users who are viewing this thread

Back
Top Bottom