By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,667 Members | 2,611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,667 IT Pros & Developers. It's quick & easy.

OnPrint Event

P: 5
Hello Bytes:

I have a MS Access report question.

BACKGROUND:
I have successfully created a report index to be used with my main report. I want this report index to print only if the user decides to manually print the main report (ie. File -> Print).

PROBLEM:
As you know, the OnPrint event executes each time a page is initially displayed on screen. In this case, I do not wish to print the report index.

QUESTION:
Is there a way to evaluate whether the Print Dialog is displayed on screen? If so, can I use it to instruct Access to print my report index?

JUST A THOUGHT:
After the user navigates the report on screen, the onPrint event will no longer fire for those pages displayed. The On Print event will only execute if the User manually prints the report. Can I use this behavior to control the OnPrint event?

Thanks,

BigJohnT
Oct 10 '09 #1
Share this Question
Share on Google+
4 Replies


NeoPa
Expert Mod 15k+
P: 31,275
If I understand you correctly John you are wanting to trigger some code (the opening/printing of a separate report) when one report is sent to the printer (The term print here is misleading as Access refers to sending something to the screen as a print - in PrintPreview mode). Is that right?

You should understand that the OnPrint event is only associated with report sections. Not reports or even the printing (sending to printer) of them.

Welcome to Bytes!
Oct 10 '09 #2

P: 5
NeoPA,

Thanks for getting back with me.

Your understanding of my issue is correct. I wish to trigger some code (the printing of a separate report) when one report is sent to the printer and not to the screen.

I have code in the "PageHeaderSection" of my main report to perform this function. The code works fine but I only need it to execute one time and that is when the user sends the report to the printer.

Is there any way for Access to detect whether the Print dialog box is open?

Thanks again,

BigJohnT
Oct 13 '09 #3

NeoPa
Expert Mod 15k+
P: 31,275
As far as I can see, Access doesn't differentiate between where it sends the printed report. As far as the code knows, it goes to the printer. If it is only sent to the screen, then what does it care (so to speak). Not good news for you I know. I know of no way to capture the actual act of printing per se. It may be possible to do it through Operating System calls, but I don't know them well enough to be able to help there I'm afraid.

Another expert may have some help to offer though. Let's see what turns up.
Oct 13 '09 #4

P: 5
NeoPa,

I thank you for your time. Lets see what turns up.

Thanks again.

BigJohnT
Oct 14 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.