Can't build Simple Printer Select List in Access97?
Posted on 2000-02-28
I want the users to be presented with a simple listbox in Access97 with the names of the printers in their windows control panel printer list. When they click one it should become the new default printer so anything they then click the quick PRINT button on will go to this selected printer. (working VBA code to do this is the quick answer for points)
Lacking that, here is the discussion for us to review as a group of VB/VBA experts:
I'd like to avoid using the common dialog because of the bugs with it not always setting the default to the new choice and also not everyone HAS the common dialog so the API is really ideal and what is needed for this default printer selector. I've got the code to do this in VB and it works great but this simple code
for each x in printers
which works great in VB6, gives me an error in Access97 saying "printers" is not a valid variable (object) in Access97? So how DO you get the list of printer names in Access? Can we access the Printers Collection somehow from within Access97?
For general knowledge and reference the VB version of the "PRINTERS COLLECTION" acts differently on NT than on Windows95. The Printers.Port is what gets set to default for 95/98 while the Printers.DeviceName is what is needed to set default printer on NT4! Anyone else noticed this?