Closing a report in print preview

V

Vel.

OK, this is an offshoot from a thread I started some time ago regarding
dynamic page margins. The thread has since wandered off topic, so I decided
to post my new question more clearly.

I have a form with some parameters which are passed to a report. On the
form is a button to print the report.

The OnClick event of the button does teh following:
1. The form's visible property is set to false.
2. The report opens in design mode
3. Various bits of data from the form are used to adjust the page margins
of the report
4. The report opens in print preview mode.

The Report's OnClose event does the following
1. Brings up a dialog box asking if the report printed correctly.
a. if "yes" then an update query is run.
b. if "no" then no special action occurs.
2. The original form's visible property is set to True.

My problem is that when everything is said and done, the report is still
open in Design Mode in the background. I need to, for some event, close the
report in design mode without saving (in order to preserve the default page
margins).

I was thinking I need to put the following line of code somewhere
docmd.Close acReport, stName, acSaveNo

I just don't know where to put it. I cannot put it in the report's OnClose
event. I tried to put it on the form's OnActivate event, but it didn't seem
to fire there either. Any suggestions?

Vel.
 
Top