If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Print multiple reports from first printer
I am trying to write VBA on a form button on_click event that will open
report1 and allow the user to choose which printer he/she would like to use. I would then like report1, report2, report3 and report4 to all print to that printer, without the user having to keep picking the printer. I've tried for hours and can't get this to work. Any suggestions are appreciated. Thank you. |
#2
|
|||
|
|||
Print multiple reports from first printer
If this is Access 2002 or later, you can set a printer like this:
Set Printer = Printers(1) Access will then use that printer until you reset it to the Windows default with: Set Printer = Nothing This assumes you have not set up the report to go to a particular printer (using the Page Setup dialog in report design view), but that it is set to go to the default. You probably want to use the DeviceName of the printer rather than its number. You can get its name in the Immediate Window with: ? Printers(1).DeviceName and then use the name like this: Set Printer = Printers("xxx") For an example of how to create a combo box loaded with the user's current printers, see: http://allenbrowne.com/AppPrintMgt.html That utility goes further than you want (assigning a custom property to a report so it remembers which printer to use for that report), but it may be worth downloading the sample to see how to load the combo and work with the Printers collection. For Access 2000 or earlier, this technique will not work. The page contains links for A97 and A2000 databases to samples created by Albert Kallal (Access MVP.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Alex" wrote in message ... I am trying to write VBA on a form button on_click event that will open report1 and allow the user to choose which printer he/she would like to use. I would then like report1, report2, report3 and report4 to all print to that printer, without the user having to keep picking the printer. I've tried for hours and can't get this to work. |
#3
|
|||
|
|||
Print multiple reports from first printer
Thank you Allen. Your site is always so helpful.
"Allen Browne" wrote: If this is Access 2002 or later, you can set a printer like this: Set Printer = Printers(1) Access will then use that printer until you reset it to the Windows default with: Set Printer = Nothing This assumes you have not set up the report to go to a particular printer (using the Page Setup dialog in report design view), but that it is set to go to the default. You probably want to use the DeviceName of the printer rather than its number. You can get its name in the Immediate Window with: ? Printers(1).DeviceName and then use the name like this: Set Printer = Printers("xxx") For an example of how to create a combo box loaded with the user's current printers, see: http://allenbrowne.com/AppPrintMgt.html That utility goes further than you want (assigning a custom property to a report so it remembers which printer to use for that report), but it may be worth downloading the sample to see how to load the combo and work with the Printers collection. For Access 2000 or earlier, this technique will not work. The page contains links for A97 and A2000 databases to samples created by Albert Kallal (Access MVP.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Alex" wrote in message ... I am trying to write VBA on a form button on_click event that will open report1 and allow the user to choose which printer he/she would like to use. I would then like report1, report2, report3 and report4 to all print to that printer, without the user having to keep picking the printer. I've tried for hours and can't get this to work. |
Thread Tools | |
Display Modes | |
|
|