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

Running multiple reports from form criteria problem 1

Status
Not open for further replies.

Cloonalt

Programmer
Jan 4, 2003
354
US
I have a form where users enter criteria and then click on a "Print" button. A report runs and minimizes. That works fine.

However, if they enter new criteria and click on the "Print" button while the first report is still opened, the second report doesn't get created. The first one is still there.

I either need to be able to have multiple report run and minimize, or warn the user to close the first report before they run a second.

Any ideas? Thanks.
 
Why are you running it and minimizing it? If you just want to Print it, use the OpenReport method and set the last argument to acNormal. That will automacially print the report without ever actually opening it on the page.

Paul
 
Yes, that's an option that I might go to. But the user prefers to view the report first.

Thanks for your reply.
 
Well, you could test to see if a report is open on the click event for your button and if one is, then pop up a message box that says,
"Sorry but only one report at a time. Would you like to close this report????"
and then give them a Yes/No button that will close the existing report.

I think there is a GetState() method that will tell you whether a report is open or not.

Paul
 
That's what I'm looking for. I'll search for something on GetState()

Thanks.
 
Sorry I had to look it up. Been a few years since I used it.
Code:
If SysCmd(acSysCmdGetObjectState, acReport, "Dictionary_Index") Then

The last argument is the name of the report I was testing to see if it was open. If you are only using one report then this would work well, If you have muliple reports, you could pass the name of the report that is open to a Public variable, and use that variable in the last argument of the SysCmd method.
Try it out and post back with any specific issues.

Paul
 
Paul:

Below works. Thanks for your help.

If SysCmd(acSysCmdGetObjectState, acReport, "rptName") Then
MsgBox "A report is already is open. " & _
vbCrLf & "Please close it to " & _
vbCrLf & "create a new report.", vbInformation + vbOKOnly, "Report Open Warning"
Exit Sub
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top