on close, print report

D

David Pelizzari

I am trying to have a report that when the preview is closed (On Close) the
report prints. Ideally, it would be nice if it prompted the user on close if
they wanted to print (bonus points for that). I would be most appreciative
of some code that I can "borrow" to get this done.
 
F

fredg

I am trying to have a report that when the preview is closed (On Close) the
report prints. Ideally, it would be nice if it prompted the user on close if
they wanted to print (bonus points for that). I would be most appreciative
of some code that I can "borrow" to get this done.

ASFIK No, you cannot print the report from the report's close event.

While the report is previewed, why not just press
ctrl + P
Or click on ....
File + Print?
 
L

Larry Linson

I agree with fredg. My users have always appreciated having reports
presented in preview so they could look them over before printing. Then, if
they noted a discrepancy, they could close the preview, do what was
necessary to correct it, and then redisplay and print.

If you take that control away from the user, then there will be times that
they print a report that has to be reprinted later, after some error has
been corrected.

That said, I see no reason why you can't issue a DoCmd.OpenReport in the
Close event, with the appropriate option to print, if you feel compelled to
do so -- but I still don't think it is A Good Idea.

Larry Linson
Microsoft Access MVP
 
D

David Pelizzari

Thank you to you both, the users are used to having a command that prints
automatically, so they don't usually see the preview, I tried putting in the
DoCmd.OpenReport in the OnClose, however, since the report is open, it errors
out. Just thought this would be a nice to have. Perhaps a dialogue box that
pops up on close.. "Do you wish to print? Y/N" On Yes, print, on No,
close. Hmm, that may work, I would have to close the report first, but the
report data is being pulled from a temp table anyways, so the data would
still be there.

Larry Linson said:
I agree with fredg. My users have always appreciated having reports
presented in preview so they could look them over before printing. Then, if
they noted a discrepancy, they could close the preview, do what was
necessary to correct it, and then redisplay and print.

If you take that control away from the user, then there will be times that
they print a report that has to be reprinted later, after some error has
been corrected.

That said, I see no reason why you can't issue a DoCmd.OpenReport in the
Close event, with the appropriate option to print, if you feel compelled to
do so -- but I still don't think it is A Good Idea.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top