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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.