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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Instances of a Report & Printer Error

Status
Not open for further replies.

sgidley

Programmer
Nov 19, 2008
20
US
Hello,
I am opening multiple instances of a report using New, such as: (report_args is a global variable that gets used in the reports Open event because OpenArgs is not usable this way)

Dim smt_report As New [Report_Defect Tracking]
Dim assy_report As New [Report_Defect Tracking]

report_args = "SMT REPORT"
smt_report.Visible = True

report_args = "ASSYMBLY REPORT"
assy_report.Visible = True

If I let this code run, the two reports open (almost..outlines are visible on the screen) but an error comes up, "There was a problem retrieving printer information for this object. The object may have been sent to a printer that is unavailable"

Of course, there is indeed a printer and it works fine from access. Why is it even looking for a printer? I want to open the report and view it on the screen then let the user decide if they want to print it.
To top things off, if I step through the above code in the vbe debugger(it also goes in and steps through the report's open event code when the .visible line is reached) then everything works fine. Reports show up on the screen and no printer error. grrrrr. any ideas?

ps, I even tried bringing in the Sleep function and slowing it way down between report openings, no luck.

Thanks

 
Ok, thought of something on a good nights rest. I put in the magic DoEvents command between each ...Visible = True command and all is well now. I still welcome any insight on why DoEvents is needed, but at least my problem appears to be solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top