How to print a report from different machines? (1 Viewer)

deletedT

Guest
Local time
Today, 16:21
Joined
Feb 2, 2019
Messages
1,218
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.

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.
 

deletedT

Guest
Local time
Today, 16:21
Joined
Feb 2, 2019
Messages
1,218
Hi. See if this demo from UtterAccess can help with your situation.

I've had done something like this a while back, but not this complex. I was saving the info in User option - Machine option & system option tables. But I faced some critical problems that I had to stop using it.

Today is Saturday and Monday is a national holiday here in Japan. I will check it on Tuesday as soon as I'm back to work and will report back here.

Million thanks for your help.
 

deletedT

Guest
Local time
Today, 16:21
Joined
Feb 2, 2019
Messages
1,218
I checked the file. Though it has some critical short comings, but I could find a hint that solved my problem.
I added the following to my own code, and I was able to do what I was looking for.

Code:
Reports(ThisReport).Printer=ThisPrinter

I was working on Application.Printer only and had no idea I have to set Report's printer too.

Million thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:21
Joined
Oct 29, 2018
Messages
21,449
Hi. You’re welcome. Glad to hear you got it to work. Good luck with your project.
 

Users who are viewing this thread

Top Bottom