Closing a form on close of report

S

Scott

Hi all,
Wondering if someone can tell me where I'm going wrong here.
I have a form that is sitting in the background during a 'preview'
of a report, that I want to close at the same time the report closes. (it
needs to stay open while the report is open BTW) I thought the docmd would
do it for me, but I can't get the syntax right. I have as follows at the
moment -

Private Sub Report_Close()

DoCmd.Close (acForm,"frm_MyForm")

'Once report and calling form are closed open main form back up
DoCmd.OpenForm "frm_MainForm"

End Sub

If I have the 'acForm' in there, I get a syntax error, and if I get rid of
it, I get a 'Type Mismatch' error.

Any help would be greatly appreciated

Thanks
Scott
 
F

fredg

Hi all,
Wondering if someone can tell me where I'm going wrong here.
I have a form that is sitting in the background during a 'preview'
of a report, that I want to close at the same time the report closes. (it
needs to stay open while the report is open BTW) I thought the docmd would
do it for me, but I can't get the syntax right. I have as follows at the
moment -

Private Sub Report_Close()

DoCmd.Close (acForm,"frm_MyForm")

'Once report and calling form are closed open main form back up
DoCmd.OpenForm "frm_MainForm"

End Sub

If I have the 'acForm' in there, I get a syntax error, and if I get rid of
it, I get a 'Type Mismatch' error.

Any help would be greatly appreciated

Thanks
Scott

No parenthesis.
DoCmd.Close acForm,"frm_MyForm"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top