View Full Version : Generated preview reports disappearing


Srome
05-08-2008, 01:41 PM
I have several groupings of reports (3 to 5 related reports generated from a click event) which worked ok when they went directly to a printer;
but when I changed the them to use acViewPreview so that reports can be checked prior to printing, one or more of them would close(as if Esc had been pressed) on there own after being generated. Also, if a break point were set and execution is single stepped the reports created the previews ok.

Code sample:
DoCmd.OpenReport "rptOldMonthTax1", acViewPreview
DoCmd.OpenReport "rptOldMonthTax2", acViewPreview
DoCmd.OpenReport "rptOldMonthTax3", acViewPreview

Environment:
Access 2000 (9.08948 sp-3)
Win2000 Pro 5.0.2195 sp 4 build 2195
Pentium4 3gh

RuralGuy
05-08-2008, 03:30 PM
Add acDialog so the previews will be modal:
DoCmd.OpenReport "rptOldMonthTax1", acViewPreview, , ,acDialog
DoCmd.OpenReport "rptOldMonthTax2", acViewPreview, , ,acDialog
DoCmd.OpenReport "rptOldMonthTax3", acViewPreview, , ,acDialog

Srome
05-09-2008, 01:02 PM
:confused:I just tried using acDialog on all 3 reports and continue to have the 3rd report disappear, just as before.

RuralGuy
05-09-2008, 02:49 PM
acDialog is the 5th argument. Did you include the commas as I have?

pbaldy
05-09-2008, 03:44 PM
You don't by chance have a

DoCmd.Close

in there to close a form, do you? If so, you probably need to add the appropriate arguments so it closes the form rather than the default active object, which would be the last report opened.