Juan Velasquez
asked on
How to reconnect to network printer using vba
Hello,
A client running an Access 2007 application, reports that the print servers occasionally go down and then come back up. When it does this, users of the access application have to reconnect to the printers. Is there a way to do this via vba. I have a created a table that lists printers used for each access reports. Since some of the reports use the same printers, I created a query that returns all the absolute path to all the distinct printers in use by the application. I then use this query in the code below to loop through each file path. I'm just trying to figure out how to connect to that printer once I retrieve it's file path.
A client running an Access 2007 application, reports that the print servers occasionally go down and then come back up. When it does this, users of the access application have to reconnect to the printers. Is there a way to do this via vba. I have a created a table that lists printers used for each access reports. Since some of the reports use the same printers, I created a query that returns all the absolute path to all the distinct printers in use by the application. I then use this query in the code below to loop through each file path. I'm just trying to figure out how to connect to that printer once I retrieve it's file path.
Public Function ResetPrinters()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim intX As Integer
Dim strPrinterPath As String
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("qryPrinters")
Set rst = qdf.OpenRecordset
rst.MoveLast
rst.MoveFirst
For rst = x To rst.RecordCount - 1
strPrinterPath = rst(x)
Next
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Jim.
ASKER
Sorry for the delay in posting my solution.
ASKER
I've done some more research, and I think something like the code below may work. However, how do I check to see if a network printer is already connected.
Open in new window