Closing a form when a report opens

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a prompt form that the user selects which records to run a report on.
When the report opens I want the form to close. I've used this simple code
but it doesn't work. Anyone help?
Private Sub Report_Open(Cancel As Integer)

DoCmd.Close acForm, Me.Name

End Sub

Thanks
Tony
 
Me refers to the currently active object. Since that code is in the report's
Open event, "Me.Name" refers to the name of the report. You'll have to
replace that with the actual name of the form:

DoCmd.Close acForm "MyFormName"
 
I've used this Doug
Domcmd.Close acForm frmviewid
and i get an error message

Runtime error 2493
This action requires an Object name argument

What have I done wrong?
Thanks
Tony
 
Back
Top