Report and Form

_Brian_

Registered User.
Local time
Today, 01:35
Joined
Nov 26, 2004
Messages
29
ACCESS.
I have a report and I want that before ejecutarce it calls to a form where it has q to select to an arrangement criterion eye. I have necessary mind q to before call to report q the form. I cannot call to the form and despues the report.

Report - > a pause or any thing q me of has its execution - > form - > infome with the arrangement criterion

Somebody with one devises
 
I don't particularly like that approach myself, I prefer opening the form first, then open the report. But I think these are the steps:

In the on open event of the report, open the criteria form with the acDialog option, which halts code execution until the form is closed. Then prior to allowing the report to continue, you'll need to check whether the form is still open, which it will need to be to use the crieteria. If not, cancel the opening (for 2000+ versions, you should be able to do that thru the allforms collection, else find the IsLoaded function in the NorthWind sample database, which came with the Access installation):

docmd.openform "frmCriteria",,,,,acdialog
if not currentproject.allforms("frmCriteria").isloaded then
cancel=true
end if

In the form, use at least one button (OK?), whith only code to make the form not visible

Me.visible=false

perhaps also a cancel button, with only

me.close acform, me.name

In the on close event of the report, close the form, if it's still open

if currentproject.allforms("frmCriteria").isloaded then
docmd.close acform, "frmCriteria"
end if

You'll need to trap the 2501 error in the form where this report is called from
 
Since I eliminate the mistake 2501 q it(he,she) jumps me on having cancelled the report ¿?
 

Users who are viewing this thread

Back
Top Bottom