Some headache for those who like solving problems.
It's a long story. So bear with me please.
The scenario:
I have more than 10 users who use a Access front end database to work on data from a SQL server database. Each user has a copy of Access front end and works on his/her own work station.
Each machine(PC) can use 5 network printers for printing reports/orders etc. Most of reports are designed to be sent to a specific network printer. Job done and everybody is happy.
The Problem :
We have several reports that need to be printed from a local printer. And apparently if I set them to use a printer from PC1, other users on other PCs can't use them. Because their local printer is different.
At present I'm doing this:
1- Change the default printer
2- Send the report job to printer
3- Restore Machine's default printer to what it was.
This method works but is not stable.
Access takes a while to collect data and send it to printer on Docmd.OpenReport
but the module is running and doesn't wait. When job is sent to printer, default printer is already restored.
I could use a timer in the code to be sure the data is sent to printer and then restore default printer. But the amount of timer differs every time, based on the amount of records need to be printed.
Any suggestion/advice is much appreciated.
It's a long story. So bear with me please.
The scenario:
I have more than 10 users who use a Access front end database to work on data from a SQL server database. Each user has a copy of Access front end and works on his/her own work station.
Each machine(PC) can use 5 network printers for printing reports/orders etc. Most of reports are designed to be sent to a specific network printer. Job done and everybody is happy.
The Problem :
We have several reports that need to be printed from a local printer. And apparently if I set them to use a printer from PC1, other users on other PCs can't use them. Because their local printer is different.
At present I'm doing this:
1- Change the default printer
2- Send the report job to printer
3- Restore Machine's default printer to what it was.
Code:
Dim W As New WshNetwork
W.SetDefaultPrinter (TempPrinter)
DoCmd.OpenReport ThisReport, acNormal, , fltr
W.SetDefaultPrinter (DefPrinter)
This method works but is not stable.
Access takes a while to collect data and send it to printer on Docmd.OpenReport
but the module is running and doesn't wait. When job is sent to printer, default printer is already restored.
I could use a timer in the code to be sure the data is sent to printer and then restore default printer. But the amount of timer differs every time, based on the amount of records need to be printed.
Any suggestion/advice is much appreciated.