Closing a report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code that prepares a report to be printed. At the end of the code the
report is presented in preview mode and the user can print the report using
the print menu. When the user closes the report the msgBox appears to ask if
the report should be saved. I would like to prevent the message box from
showing.

Probably I should hide the menu and put a print button on the report, but I
don't know how to do that, either.
 
hi.
to stop the display of warning/alerts, put in your code
docmd.setwarnings false
be sure to turn them back on again after the close
docmd.setwarnings true
the command button to print is a good idea.
DoCmd.OpenReport "reportname", accpreview
regards
Frank
 
hi again
for the button code...
docmd.setwarnings false
DoCmd.OpenReport "reportname", accpreview
docmd.setwarnings true
regards
Frank
 
I don't see that this will work. Setwarnings false resets automatically
after the code is completed. In this case, the code is attached to a button
on a form. The form is used to select the fields to be presented in the
report. When the button is pushed the code executes to completion. The last
comand is DoCmd.OpenReport "reportname", accpreview.

At that pont the code is finished and

docmd.setwarnings true occurs, regardless.

The question is, once the previw occurs, how do I close it without the
Access generated warning?
 
Miaplacidus,

How about saving the report with a docmd.save before
previewing the report. The report is then saved and
shouldn't prompt the user.

Terry
 
The report is generated from a saved report and modified according to
selections on a form. I do not want to save the report for fear it will
screww up the operation next time. The reason I want to urn off the report is
so that the do wyou want to save message does not appear.
 
Back
Top