cancel update of record

C

Chegu Tom

I want to put a button on my form with code that will tell access to close
the form and not update the current record.

Assuming the user has entered information on the form and then reailzes he
doewnt want that info in the database

Thanks
 
J

John W. Vinson

I want to put a button on my form with code that will tell access to close
the form and not update the current record.

Assuming the user has entered information on the form and then reailzes he
doewnt want that info in the database

Thanks

Use the Code Builder to put into the [Event Procedure] of the command button's
click event:

Private Sub cmdQuit_Click()
Me.Undo ' erase all changes to the current record
DoCmd.Close acDataForm, Me.Name ' close the form
End Sub

John W. Vinson [MVP]
 
C

Chegu Tom

me.Undo

me.DUH or me.DOH (Homer Simpson style)

Thanks. For some reason I could not remember that.

Tom

John W. Vinson said:
I want to put a button on my form with code that will tell access to close
the form and not update the current record.

Assuming the user has entered information on the form and then reailzes he
doewnt want that info in the database

Thanks

Use the Code Builder to put into the [Event Procedure] of the command
button's
click event:

Private Sub cmdQuit_Click()
Me.Undo ' erase all changes to the current record
DoCmd.Close acDataForm, Me.Name ' close the form
End Sub

John W. Vinson [MVP]
 
Top