Closing Form with VBA Code

F

Frank Wagner

As the last step in a VBA procedure triggered by a form
event, I would like to close the form. When I place the
command "DoCmd.Close" in the procedure, I get error
message 2585 - - "this action can't be carried out while
processing a form event"

Is there any way around this so I can automatically close
the form?

Any help would be appreciated

Frank Wagner
 
R

Rick Brandt

Frank Wagner said:
As the last step in a VBA procedure triggered by a form
event, I would like to close the form. When I place the
command "DoCmd.Close" in the procedure, I get error
message 2585 - - "this action can't be carried out while
processing a form event"

Is there any way around this so I can automatically close
the form?

Any help would be appreciated

Frank Wagner

Depends on the event. Which one are you using? In most events it should work
fine.
 
G

Guest

The event is "On Exit" from a text box, and the code
would come right after the user answers yes to a message
box notification.
 
Top