Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping a Report From Closing

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
0
0
GB
I have a report in my database for printing address labels which is based on a temporary table which is emptied once the report has been created.

When the user clicks the control box nutton in the top right corner of the report I want to prompt the user and give them the chance to cancel the close action but I can't figure out how to do this.

Any thoughts?
 
How are ya barrylowe . . .

If the report has already been sent to the print que, [blue]whats the point of stopping the report from closing?[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
The user may not have printed the labels yet so I want to give them the chance to do so before closing it.

As for the other suggested article, Report objects do not have an Unload event so that can't be used.
I have already put code in the Close event but unfortunately it does not have a Cancel option to prevent the form closing, so all it does is execute any code in the event and then close the form.

What I need is code to stop the report closing.
 
Have two separate open options:

Open in print preview:

DoCmd.OpenReport "rptReportname", acViewPreview, WhereClause:=strWhere

Print direct to default printer:
DoCmd.OpenReport "rptReportname", acViewNormal, WhereClause:=strWhere

John
 
That's not really suitable as the printing is the culmination of a series of operations.

I've managed to fix it myself by putting code in to reopen the report before the source table is emptied:

==============================================================
reopen:
boolReprint = False
DoCmd.OpenReport "Mailmerge_Labels", acViewPreview, , , acDialog
If boolReprint Then GoTo reopen
==============================================================

The boolReprint reprint is set in the Close event of the report when the user is prompted as to whether they want to close it or not. So the report always gets closed but is reopened under the right circumstances.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top