Closing a form on close of report

  • Thread starter Thread starter Scott
  • Start date Start date
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
 
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"
 
Back
Top