robertlewisnet
New member
- Local time
- Today, 08:04
- 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
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: