Close a popup form after submitting a report

I have a popup form (currently set to modal = NO and popup = YES).   The form collects some values for a report.  I have a button on the form that submits the report.  This works fine, but I cannot get the popup form to close after the report runs.  How can I do this.

I did put a DoCmd.Close after the call to run the report, but that appears to close the report.

There is a second button on the form that just executes the DoCmd.Close, and this will close the form, but of course I want it to happen automatically after the report runs and displays.

Regards
Richard
rltomalinAsked:
Who is Participating?
 
Gustav BrockCIOCommented:
At the OnOpen of the report call:

    Forms!YourPopupForm.Visible = False

or simply close the form specifically:

    DoCmd.Close acForm, Me.Name

/gustav
0
 
rltomalinAuthor Commented:
Thanks gustav

The exact code you suggested gave an error (DoCmd.Close acForm, Me.frmName)

I changed to - DoCmd.Close acForm, "frmName"

That is working fine.

Regards

Richard
0
 
Gustav BrockCIOCommented:
Yes, Me.frmName will fail.

It was supposed to be Me.Name which returns the name of the current form - which seems to be "frmName".

/gustav
0
 
rltomalinAuthor Commented:
I see!!  Sorry I misunderstood your response.

I have just tried that and it works fine, and is a little more concise, so I will use that.

Richard
0
 
Gustav BrockCIOCommented:
Great! Thanks for the feedback.

/gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.