How to 'see' (from code) the moment when a video report is sent to print?

amorosik

Member
Local time
Today, 19:18
Joined
Apr 18, 2020
Messages
505
Access procedure that starts a preview of a document on the screen
The preview enables the PRINT, DIMENSIONS, MARGINS, etc. keys, typical of preview reports
I would like to start some code when the operator sends the report to print, and then when he presses PRINT, the printer choice panel appears, and then presses OK
So my code must execute ONLY if the print is physically sent to the printer
Then the question is: how to start some code when the report is sent (by operator) to printer?
 
You can’t. The print command is internal to access and you must wait for it to finish.
but you could try putting code in the ON PRINT event in the report.
 
You can’t. The print command is internal to access and you must wait for it to finish.
but you could try putting code in the ON PRINT event in the report.

Thanks for the advice
But there is no OnPrint event on the report
There are OnPRint events on various sections like page header, report header, body, etc.
I tried to see with a debug.print line, when the various events are called
And it seems to me that the OnPrint event is called during video display and therefore it is of no use to me because the operator could also close the report to video without launching it in print
 
Last edited:
This might or might not work. Use a report.page event, which occurs after a full page has been formatted but before it is printed.

https://learn.microsoft.com/en-us/office/vba/api/access.report.page(even)

You can search the forum (or web) for "access event when printed" or variations on that theme. If you do, you find that this problem is not new. It crops up every now and then. First example is 2011.


Here's a reference that also recommends the report.page event as a possibility. Note that the events you can see are all independent of whether the report is actually going to a physical printer or to a pseudo device. Note, however, that if you print to a pseudo-device, it still counts as printing. Like printing to a .PDF converter.


The general consensus has been in the past that you cannot tell if you have printed anything unless the printer is physically connected to your computer hard-wired, or if your printers are served by a system that has the hard wiring and some software that counts pages or something like that so that you can query that. NONE of those solutions involve Access by itself. You might have some issues in getting the printer to tell you anything because the printer's manager - if it even HAS one - isn't (usually) on your computer so you can't force it to tell you anything anyway due to rules on interprocess communication across the network. And many modern network-aware printers are their own managers.
 
This might or might not work. Use a report.page event, which occurs after a full page has been formatted but before it is printed.

https://learn.microsoft.com/en-us/office/vba/api/access.report.page(even)

You can search the forum (or web) for "access event when printed" or variations on that theme. If you do, you find that this problem is not new. It crops up every now and then. First example is 2011.


Here's a reference that also recommends the report.page event as a possibility. Note that the events you can see are all independent of whether the report is actually going to a physical printer or to a pseudo device. Note, however, that if you print to a pseudo-device, it still counts as printing. Like printing to a .PDF converter.


The general consensus has been in the past that you cannot tell if you have printed anything unless the printer is physically connected to your computer hard-wired, or if your printers are served by a system that has the hard wiring and some software that counts pages or something like that so that you can query that. NONE of those solutions involve Access by itself. You might have some issues in getting the printer to tell you anything because the printer's manager - if it even HAS one - isn't (usually) on your computer so you can't force it to tell you anything anyway due to rules on interprocess communication across the network. And many modern network-aware printers are their own managers.

Yes, thank for your help
I also found this post very interesting, it shows how to build a custom menu to link to a specific report, and basically solves my problem
But I also want to explore the possibility of 'seeing' what happens in the print spooler using this example
 
Other solution for this problem, at point n.8 of this video of Karl Donaubauer
This method is exeptionally simple to know when the report is sent to printer
Other very useful routine on this video/code
 
Thanks for posting a potential solution. You never know when someone might find it useful.
 

Users who are viewing this thread

Back
Top Bottom