problem with closing form

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
 
K

Kelvin

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
 

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