is there any way you can have a drop down list which displays a list of the printers installed?
For example, maybe you could have a table which lists the printers (looks at the installed printers everytime the database is opened maybe??) and you then point a combo box to this table? I could then set this as a variable to select which printer I want specific reports to come out on without having to go into the page setup for the report, cheers.
Well...I know of a couple ways you can do this...The easy way, or the harder way (just in case someone wants to know).
The Harder Way:
You can use some Windows API functions to carry out this task with the main call being the EnumPrinters function which is located within the WinSpool.drv library. Although more cumbersome, the API can provide a lot more information about your printers than the much easier method.
You can see the required code located within the database module that is contained in the provided Access sample. Points of interest are of course the code module which supports all the API declarations and the function which fills the supplied Combo or List box, and the Form's OnOpen event which hold the Call to this function (FillListWithPrinters).
The Easy Way:
Simple....Reference the Microsoft Office 10.0 Object Library (from within your VBE) and use the Printers Object. Again, the provided Access sample shows you how. For those that want to know NOW...here it is:
Private Sub FillComboButton_Click()
' Fill the supplied control with the name of each printer
' First, make sure the control RowSourceType is set to Value list
Me.myPrintersCombo.RowSourceType = "Value List"
Dim prtLoop As Printer
For Each prtLoop In Application.Printers
Me.myPrintersCombo.RowSource = Me.myPrintersCombo.RowSource & _
prtLoop.DeviceName & ";"
See the provided MS-Access sample:
Self Taught In ALL Environments.....And It Shows!