problem with closing form

  • Thread starter Thread starter arminebelle
  • Start date Start date
A

arminebelle

Hi

I have a form and I am opening new form and closing
current one by executing following statement on the click
button event

DoCmd.OpenForm "Master", acNormal
DoCmd.GoToRecord acDataForm, "Master", acNewRec
DoCmd.Close acForm, Me.Name

I am getting error message 2585 this action can not
carried out while processing form or report event

Help
thank you
 
I assume you are trying to close the calling form. Close that form first.
The rest of the code will still run.

DoCmd.Close
DoCmd.OpenForm "Master"
DoCmd.GotoRecord , , acNewRec

You don't need to use the name of the form since it is still the active
object. When opening a form, acNormal is the default so you don't need to
specify that. GotoRecord automatically defaults to the currently open form
so the new form "Master" wil lbe the defualt and does not need to be
specified.

Kelvin
 
Back
Top