Crashing Whilst Reports Are Running

houseofturner

Registered User.
Local time
Today, 21:20
Joined
Dec 10, 2009
Messages
37
I have a series of 14 reports which I need to preview and then print.

Rather than do them one at a time I would like to open them all in preview mode at the click of the button.

All the reports preview fine if run one at a time or in batches of 3 or 4. However if I run a batch of 14 it always crashes and says database needs to close and asks if I want it repaired (which makes no difference).

The code I am using is shows below - any ideas> please!!!

DoCmd.OpenReport "Report1", acViewPreview
DoCmd.OpenReport "Report2", acViewPreview
DoCmd.OpenReport "Report3", acViewPreview
DoCmd.OpenReport "Report4", acViewPreview
DoCmd.OpenReport "Report5", acViewPreview
DoCmd.OpenReport "Report6", acViewPreview
DoCmd.OpenReport "Report7", acViewPreview
DoCmd.OpenReport "Report8", acViewPreview
DoCmd.OpenReport "Report9", acViewPreview
DoCmd.OpenReport "Report10", acViewPreview
DoCmd.OpenReport "Report11", acViewPreview
DoCmd.OpenReport "Report12", acViewPreview
DoCmd.OpenReport "Report13", acViewPreview
DoCmd.OpenReport "Report14", acViewPreview

MsgBox "All Reports Have Been Generated", vbOKOnly + vbInformation, "Management Info Pack"
 
do you want them all to open together.

if not then this will hold each report until its closed


DoCmd.OpenReport "Report1", acViewPreview
while isopen("report1",acreport)
doevents
wend

etc


Function IsOpen(strName As String, Optional objtype As Integer = acForm)
IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
 
do you want them all to open together.

if not then this will hold each report until its closed

Hi

Not sure I understand. Not really a programmer but doesn't wend need a while and isopen need to be defined? Do I just repeat the code you wrote and change the report name each time?

Basically I just want it to open one report then the other, then the other etc until they are all open. I can then review them together and decide which ones to actually print.
 
May I suggest you include all 14 reports into 1 main report as sub reports then run the main report, effectively generating all 14 reports. If you place the reports in a group and instruct the group to force a new page after each report then you can detemine which pages to print.
 

Users who are viewing this thread

Back
Top Bottom