Declare variable as Printer Does not work (1 Viewer)

robertlewisnet

New member
Local time
Today, 07:19
Joined
Mar 21, 2005
Messages
8
I'm trying to run some vb code that declares a printer and then prints on a specific printer that is found. When I try to run the code an error comes up as: "Compile error: User defined type not defined". I saw an earlier posts that said something about the Printers not being accessible, but I just can not believe that.

Below is my sample code: When the error comes up it highlights the: " Dim PrtDefault As Printer" . My line of thinking is I am probably going to have to add a refrence in but I do not know which one it is. Am I right? or is there something else that I am doing incorrectly?

I'm using Access 2000 on an XP Pro box.


Private Sub Command148_Click()
Dim prtDefault As Printer

Set Application.Printer = Application.Printers(0)

Set prtDefault = Application.Printer

With prtDefault
MsgBox "Device name: " & .DeviceName & vbCr _
& "Driver name: " & .DriverName & vbCr _
& "Port: " & .Port
End With
 
Last edited:

RoyVidar

Registered User.
Local time
Today, 14:19
Joined
Sep 25, 2000
Messages
805
I'm afraid you'll wait until you get 2002 or higher versions.

I'm using some stuff that came with a book (Access 2000 Developers Edition), that I can't post, but I think you may find something here
http://www.mvps.org/access/reports/rpt0009.htm
(one of the approaches, is from an earlier edition of the same book)
 

robertlewisnet

New member
Local time
Today, 07:19
Joined
Mar 21, 2005
Messages
8
Thanks for the link...I took a look at the db from the download and that's nice, but I am just not a big fan of the people having to pick their printer everytime. I do know the printer is going to be installed on the LPT1 printer port all the time. I am going to try to learn how to print by directly talking to the parallel port. This is an Eltron 2844 printer that is comonly used by UPS and Fedex for printing labels. Basically the vb code I got from Eltron/Zebra was using the Printer Options that are available starting in version 2002.

I can't believe the only solution to my problem is upgrading.
 

Users who are viewing this thread

Top Bottom