k2k2k2
asked on
Get Installed Printer list and Set Printer in Acccess 2000
Hi,
I have Access 2000 and I want to do a combobox with a list of the installed printer and the capacity to assign a printer to print a report.
Here some code I already have
'------------------------- ---------- ---------- ---------- ---------- ---------- -------
' looking for all printers and filling objListOrCombo
'------------------------- ---------- ---------- ---------- ---------- ---------- -------
Private Sub m_GetPrinters(ByRef objListOrCombo As Object)
Dim objPrinter As Printer
Dim intNbOfPrinters As Integer
intNbOfPrinters = Printers.Count - 1
For Each objPrinter In Printers
objListOrCombo.AddItem objPrinter.DeviceName
Next
End Sub
The problem is that the object Printer is not define.
Any one have an Idea?
I have Access 2000 and I want to do a combobox with a list of the installed printer and the capacity to assign a printer to print a report.
Here some code I already have
'-------------------------
' looking for all printers and filling objListOrCombo
'-------------------------
Private Sub m_GetPrinters(ByRef objListOrCombo As Object)
Dim objPrinter As Printer
Dim intNbOfPrinters As Integer
intNbOfPrinters = Printers.Count - 1
For Each objPrinter In Printers
objListOrCombo.AddItem objPrinter.DeviceName
Next
End Sub
The problem is that the object Printer is not define.
Any one have an Idea?
Check out my comments from this Q
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Realy great code for every one who have to do a Print form in Access 2000!!
The example you had linked, can you put it back out there for another user.
See this question.
https://www.experts-exchange.com/questions/20776275/Printer-Selection-for-Report-Printing-in-MS-Access.html
Joe
See this question.
https://www.experts-exchange.com/questions/20776275/Printer-Selection-for-Report-Printing-in-MS-Access.html
Joe
joe,
I'll have to do it Monday. All that code is at work. I also made a few changes to it to make it easier to use.
See ya then
I'll have to do it Monday. All that code is at work. I also made a few changes to it to make it easier to use.
See ya then
Thank you very much!
Joe
Joe
ASKER
For each PrTest in Printers
If PrTest.DeviceName = strDeviceNameOfPrinterYouW
set Printer = PrTest
' and other code to now use this printer
Exit For ' no need to test the other available printers
End If
Next
' now set it back
For each PrTest in Printers
If PrTest.DeviceName = strCurrentDevice then
set Printer = PrTest
Exit For
End If
Next