Error trying to close form with vba (1 Viewer)

penfold1992

Registered User.
Local time
Today, 19:48
Joined
Nov 22, 2012
Messages
169
Code:
Run-time error "2585"
 
This action can't be carried out while processing a form or report event.

I had a macro on a "On Click" Event which worked fine, however I wanted to use this macro elsewhere as well, so I removed it from the "On Click" event and moved it to a seperate Sub and called upon the macro from the On Click event like so: (I called the macro "Unlock_Command")
I recieved the error above so I thought trying to move the "close" command to the "On Click" event would fix that but I still get the issue...

Code:
Private Sub BtnOK_Click()
Call Unlock_Command
DoCmd.Close acForm, "CTRForm"
End Sub

Is there any way I can get around this?

Kind Regards,
Penfold
 

pr2-eugin

Super Moderator
Local time
Today, 19:48
Joined
Nov 30, 2011
Messages
8,494
What action are you trying to perform? Did you try any debugging?
 

Users who are viewing this thread

Top Bottom