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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open a report preview as modal?

Status
Not open for further replies.

Soundsmith

Programmer
Feb 21, 2001
84
0
0
US
I have the following code in a cmd button. I want the user to preview the report, optionally print it, and then have the option to delete the records involved.

Code:
dim delXcpt
DoCmd.OpenReport "rptMONRExcept", acViewPreview
delXcpt = MsgBox("OK to delete ?", vbQuestion + vbYesNo)

The preview appears, then the dialog appears over it, and the user never gets the chance to print the report.

How can I make the preview modal? The form it is called from is not a modal screen, nor do I wish it to be.

Thanks.

David 'Dasher' Kempton
The Soundsmith
 
I haven't experienced a way to open a report in acDialog mode, which stops code excecution while the report is open, as you can with forms, so this might do the trick.

Move you're delete msgbox (and other code) to the reports on close event.

HTH Roy-Vidar
 
Sorry, Roy. The msgbox event continues to activate.

I need to open the report in a modal form, but can't see how. I I created a modal form, with the OpenReport method in the Current event, but the modal window stays in front and won't let me change view to print, or even scroll. I tried hiding the form, but then the report hides also and goes directly to the printer.

Any other ideas?


David 'Dasher' Kempton
The Soundsmith
 
open you report normally....the, using the OnClose event of the report, place the code for the message box about deleting the data....just as roy suggested.

this allows the report to come up and you can do whetever you want with it...but when you close the report, the messagebox prompts you as you desire.

****************************
When the human body encounters disease it raises its temperature making it uncomfortable not only for the body but also for the disease. So it global warming the Earth's way of saying we are not wanted?

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Robert, the problem is that what I desire is to delete (or not) the records that are displayed, and then update the tables that are affected, changing several controls on the main form based on the fact there are perhaps no longer records matching this criteria. So the process you and Roy describe puts the cart before the horse, as the main form update occurs before the data have been processed.

I have found a workaround: I open the 'report' form modally. The current event calls the report. The report on open event hides the 'report' form. When the report closes, it unhides the calling form, then closes it. Then the main form cmdbutton click event that called the report form asks for the deletion. It works, but it's a bit ugly. I made the 'report' form tiny so you don't notice it for the second it's visible.

I'm sure there is a better way, but I can't find it.

David 'Dasher' Kempton
The Soundsmith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top