Exit form without saving record

L

Larry06Green

With the use of an "Exit" button, I'm trying to exit a form without saving
the record. I have the following code in my form BeforeUpdate property Cancel
= True Me.Undo
This works fine as long as there are no required fields on the form. The
problem is, I have a required field on the form with the following code in
the On Exit property, If IsNull(Me.intModelComp) Then
MsgBox "Component value must be entered before Model information can
be saved"
Cancel = True

If I start entering data on the form then click on the Exit command button,
I get a message box which states that a value is required in my model
component field.
Is there a way to suppress this message before exiting the form?
 
J

Jeanette Cunningham

Hi Larry,
assuming you don't want to save, you need to remove this code -->

On Exit property, If IsNull(Me.intModelComp) Then
MsgBox "Component value must be entered before Model information can
be saved"
Cancel = True


In other words, the On exit code has the effect of cancelling the close
without save.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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