Report Open event lauches a form to accept report parameters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sometimes I need the report itself to control the selection of report
parameters rather than receiving this information from a separate form. To
accomplish this, I want to launch a form from the On Open event of a report
itself. The form should pop up allowing the operator to make a selection
(such as report sort order).

It is not a problem to open a form from within "On Open" event, but I need
help with code to halt further opening and running of the report until the
operator has made a selection on the pop-up form and the report receives this
selection. Can anyone suggest how to do this?
 
DoCmd.OpenForm "ParameterForm",,,,,acDialog
' To Transfer parameter to report
Me!NameOfFieldOnReport = Forms!ParameterForm!NameOfFieldOnParameterForm
DoCmd.Close acForm, "ParameterForm"

You need a button on the parameter form with the following code in the Click
event:
Me.Visible = False
 
But the report will not wait for the operator to select something on
Forms!ParameterForm!MyControl. How can I stop the report until the selection
has been made, and the button clicked containing Me.Visible = false. Maybe a
loop:

Do Until Parameter form selection has been made.

Loop

Can you help with that code? Thanks...
 
I get it, acDialog keeps the form Modal until I make a selection and hide the
form. I'll try that...
 
Back
Top