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

Select a Printer to Run Multiple Reports? 1

Status
Not open for further replies.

Varga

Technical User
Mar 28, 2003
43
CA
Hello,
Ok, here is the situation. I have a database, which loads contracts, and payments, then produces a report for each contract. I have a multi-select listbox that lists each contract in the main table. The user clicks to select the desired contracts, in the listbox, then clicks a button to run a report for all selected contracts. There are 16 different reports. Each contract record has two field values that determine which report is opened.


For Each ContNum In Me.ContList.ItemsSelected
Select Case Me.ContList.Column(3, ContNum)
Case 1
If Me.ContList.Column(4, ContNum) = 1 Then
Let RptType = "Report 1"
End If
If Me.ContList.Column(4, ContNum) = 2 Then
Let RptType = "Report 2"
End If
…(etc.)
Case 2
…(etc.)
End Select

DoCmd.OpenReport _
ReportName:=RptType, _
View:=acViewNormal, _
WhereCondition:="[Contract Number] = " & _
Chr(34) & Me.ContList.Column(1, ContNum) & Chr(34)
Next


I’ve tried using the (Docmd.RunCommand acCmdPrint) method, which opens the printer dialog box. This allows the user to change printers, but it prints a copy of the form to the selected printer, then prints all the reports to the default printer.

I need a way to prompt the user to select a printer, then print every report to that printer.

Is there a way to display the available printers in a listbox, then set Access’s default printer to the value selected in the listbox? (then change it back after printing?)
Or maybe print the reports to a (spooler?), or something, then select a printer and print all the reports as one print job?

Any suggestions?
Please let me know,
Thank you,
Blair
 
Which version of Access are you using?
Access 2002 has a Printers Collection that works the same as Excel 2000, allowing you to change printer & modify printer settings.
If you are using anything else, you are into the dark world of api calls.
I have some code somewhere that works on A97 that I will try & dig out.

hth

B

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
Ben,
Luckily I am using Access 2000. I found the "PrtDevMode" property through the Access Help menu (I assume this is the one), but I'm not quite sure how to use it.
Please point me in the right direction.
Thanks for your help,
Blair :)
 
There is a demo by Albert D.Kallal available from which allows you to switch printers. It's really easy to use & provides functions to get the default printer, change the default printer & list all available printers.
Just import the code into your db, then:
store the current default printer in a string
change the printer to the required one
print your reports
change the printer to your stored value.

Job sorted!

hth


Ben

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
This is exactly what I wanted to do.
It saves me from reinventing the wheel.

The perfect solution!

Thank you very much,

Blair :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top