Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a Series of Reports

Status
Not open for further replies.

sxschech

Technical User
Jul 11, 2002
1,033
US
Hi,
Added some code to print out a bunch of report to PDF or the printer in one shot. Problem is that it runs the first two reports and then hangs (task manager indicated not responding). To try and see where the problem may be, I added some message boxes to tell me when it finishes one report and starts working on the next report. When I ran the code with the message boxes, all the reports run fine and the computer didn't hang. Of course, having the message box defeats some of the purpose since user action is required. Is there some additional code or other modification I can do to get all the reports to run and print without user interaction or hanging.

Code:
    Do While Not rs.EOF
        Call RunReportAsPDF(rs!reportname, "c:\temp\" & Replace(Mid(rs!reportname, 4), "by", Format(dtRunDate, "yy") & stLevel & Format(dtRunDate, "yyyymmdd") & "-") & ".pdf")
        MsgBox "Finished with " & rs!reportname  'for testing
        rs.MoveNext
        MsgBox "Now doing " & rs!reportname  'for testing
    Loop

Note: RunReportAsPDF came from tek-tips (can't recall the thread number)
 
Just as a thought, try replacing the msgbox with doevents. The program may be trying to finish some previous task and the msgbox is delaying it just enough to let it finish.
Doevents may allow this to finish while loading up the next report.
 
Found the thread for the run as pdf code...
Programmatically create a PDF from Access 2002
thread707-1119207
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top