Closing form "on click" of command button

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I have a form which requests input from the user as the
basis for running a filtered report. Currently the user
inputs the requested information, and presses a command
button that produces a report based on the query. At
this time, the form that requests the information doesnt
close when the report is produced. What is the code to
make this action happen, and where does it go?

Thanks in advance
Bill
 
Hi,

When you click your button to generate the report you can put in

DoCmd.Close acForm, "<form name here>"

This will close the form.

Rick
 
If the data in the form is being used as information for the report, you
probably need to leave the form open until the report is generated. You can
hide the form though, if you wish. After the OpenReport call try
Me.Visible=False in the click event of the button. When you close the
report, close the form in the Report's Close event.

DoCmd.Close acForm, "FormName"
 
That did the trick.

You guys rock!

Thanks
-----Original Message-----
Hi,

When you click your button to generate the report you can put in

DoCmd.Close acForm, "<form name here>"

This will close the form.

Rick





.
 
Back
Top