exit a record before update

  • Thread starter Thread starter Rover
  • Start date Start date
R

Rover

I have a form bound to a query. I use it to view and add records to a
table. the problem I have is if a user tries to add a new record and
wants to abort the addition, Access won't let you out with out filling
in all the required fields for that new record. How / where do I put
code to cancel the add record operation?

tia

Jim
 
Rover said:
I have a form bound to a query. I use it to view and add records to a
table. the problem I have is if a user tries to add a new record and
wants to abort the addition, Access won't let you out with out filling
in all the required fields for that new record. How / where do I put
code to cancel the add record operation?


The user already has the ability to do that by just hitting
the Esc key twice.

If you feel it's necessary, you could add a button that uses
Me.Undo to remove all their changes.

Once the user has navigated to a different record, the
record has been saved to its base table, and the only way to
get rid of it is to Delete the record.
 
I have a form bound to a query. I use it to view and add records to a
table. the problem I have is if a user tries to add a new record and
wants to abort the addition, Access won't let you out with out filling
in all the required fields for that new record. How / where do I put
code to cancel the add record operation?

tia

Jim

Train the user to hit the Escape key twice - once to cancel the edits
to the currently selected control, again to cancel the entire record.

Or, put code in a Cancel button named cmdCancel:

Private Sub cmdCancel
Me.Undo ' undo all changes to the record
End Sub

John W. Vinson[MVP]
 
Back
Top