Exit form without saving record

  • Thread starter Thread starter Larry06Green
  • Start date Start date
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?
 
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
 
Back
Top