can't reference the Printer and Printers Object

I am using Access 2000, and trying to change the printer for a report.
"Dim X As Printer" will not compile - doesn't accept Printer or Printers as an object type.
Examples that I have seen use these object types to querry the printers list.

What should I do to get this to work?

LVL 1
GaryHoffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pradapkumarCommented:
u can use Common DIalog control to show available printers and let the users to select one among them.
GaryHoffAuthor Commented:
The custiomer wants to use a specific printer that varies by user.  They do not want a pop up dialog box.
pradapkumarCommented:
then u can use printer object directly which will prints output 2 default printer assigned to that client system.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

GaryHoffAuthor Commented:
They don't want to change the default printer for the other applications.
This printer's settings is for a printer+paper tray that has letterhead so they don't want to make it the default.
Plus, this application is used by multiple users, and due to OS differences the printers have different names so just one setting doesn't work.
I want to be able to set the printer to "HP Laser" for computer "FRONT DESK" and "Cannon" for computer "BACK OFFICE".
pradapkumarCommented:
please read the following links

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_10204395.html?query=%22default+printer%22&topics=93


http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_10338782.html?query=%22default+printer%22&topics=93

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20190556.html?query=%22default+printer%22&topics=93

in addition what my suggestion is

try to store the printer assigned before ur printing starts to ur designated printer in a seperate variable.
then change the current printer by codeing for that purpose the above links will help you.
after successful completion of ur printing process just re assign the old one from the variable.

i hope this will help to you.
GaryHoffAuthor Commented:
Your examples get back to my original problem:

"Dim X As Printer" will not compile.
What do I need to do to get "Printer" to be reconized as an object?
pradapkumarCommented:
you can save the old printers name with

    strTemp = Printer.DeviceName
    MsgBox strTemp

after completed ur printing with ur newly selected printer u can restore to old one with the following code

  'Set the Printer object to the selected device
  Dim prtSelected As Printer
  For Each prtSelected In Printers
    If prtSelected.DeviceName = strTemp Then
      Set Printer = prtSelected
      Exit For
    End If
  Next


the above code will help u.
GaryHoffAuthor Commented:
you are missing the problem completely!!!!

I cannot run the above code because:

"Dim prtSelected As Printer"

will not compile.  Why is "Printer" not reconized as a valid Object?
 
pradapkumarCommented:
but my system works fine.
Please try to repair ur VS6 installation. THen try again it may work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GaryHoffAuthor Commented:
After much pain, time and trouble, I cleared everything, reinstalled the OS, Access, and the above works.
Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.