Full Version: Changing Report From Specific To Default In Vba
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
AlexTeslin
Hi,

I searched on-line but didn't find yet the solution for this. I am printing reports from VBA and setting application printer to the desired printer. But some reports for some reason appear as specific sometimes. This means that some letters coming out from one printer and other from different printer.

I was wondering if it is possible in VBA to

check if the report is set to default or specific.
If specific, then set to default.

At the moment the only solution I've got is after the opening line using this: reports(reportName).printer = application.printers(myPrinter).
This creates few problems, such as slowing down in a large loop and changing all the places in the application.

So ideally I am looking to do the check and if necessary set to default prior any printing once, only then enter a loop for printouts.

Thank you

pere_de_chipstick
Hi Alex

IMHO, it is best to set all your reports to use the default printer in the reports design, as this makes your db more transportable (ie moving to different PCs or if the printers are changed), and then use code to sent the report to a specific printer if required. You may need to open each report in design mode to examine the report set up to check/change the printer.

This post in the UA Code Archive demonstrates how to direct a report to a specific printer; In the demo, reports are assigned to report type groups, and each report type group can be assigned to a specific printer, and various default prpoperties set. When the report is previewed or printed the (pre-selected) printer and properties are automatically used for the selected report.

hth
AlexTeslin
Thank you for your reply Bernie,

I will try that as you suggested in Design view. As long I can do it once prior to a printing that should do the job. I do keep all my reports in default mode, but for some reason sometimes they end up in specific mode without me changing them. I think this could be down to me printing manually some reports and they set to specific at that point without me realising.

I hope the link can do the trick using design mode.

Thanks again
pere_de_chipstick
Hi Alex

I've had a similar problem where I've designed a report on one machine and directed the report to a specific printer and then closed (and saved) the report and it ends up setting the specific printer in the report design, which then failed when the db was installed on another PC crazy.gif

>>I hope the link can do the trick using design mode.<<
Just to clarify, in the UA code archive post, the report is directed to a different printer by setting the printer and printer attributes to be used for that print job, it does not use the report design mode and hence can be used in a database distributed as an mde or accde.

hth
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.