PRINTER LIST ON WINDOWS 2003 NETWORK

B

BIRDSPEED

I have a Printer Selection form which works fine at home (Windows and Office
2003) but when I bring it into the office (Network is Windows 2003, and also
using Office 2003).

I have the following code set up for the Printer Selection form

Private Sub Form_Open(Cancel As Integer)
' Variable to hold the default printer index.
Dim strDefaultPrinter As String

' Variable to hold the printer object.
Dim Prt As Printer

' Variable to hold the report object while cycling
' through the AllReports collection.

' Fill the printer list.
' Make sure the RowSource is empty.
Me!CmbPrinter.RowSource = ""

' Cycle through the printers installed on the machine and add them to the
combo box.
For Each Prt In Application.Printers
' Use the new AddItem method to add the printer name to the combo box.
Me!CmbPrinter.AddItem Prt.DeviceName
Next

' Remember the default printer.
strDefaultPrinter = Application.Printer.DeviceName

' Set the combo box to the default printer.
Me!CmbPrinter = strDefaultPrinter

End Sub

As I have said this compiles fine at home but comes up with a compile error
highlighting

"Dim Prt As Printer" - "User-defined type not defined" when I try the code
at the office.

Do I need to add a reference or is there something else that I need to do?
 
A

Albert D. Kallal

The printer object was only avialbe in 2002 and later....

The pritner objects is availing with the standard references in VBA.

The reference list I seen in 2003 is:

Visual basic for applications
Microsoft access 11.0 object library
OLE automation
Microsoft DAO 3.6 Object library

You should not need any more than the above, I would try and the above
machine perhaps un-checking then re-checking one of the refernce object
(like the dao 3.6 one).

I'm can't think of much that would cause your problem here. Check your
references while in the code editor on the office machines. Take a look at
the ref list..and compare it to above...

Is there any possibility that you're using a version of access before access
2002?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top