Cancelling a new record

I have a form to enter client names into a large client list that is used in different places throughout my database.  I want to have a submit button and a cancel button.  However, i basically built a form with one single textbox, and if you enter anything into the textbix, it starts a new record and enters the portion of the data.  So, How do I cancel this record?  If i have already entered some of the name, and want to cancel...how do use a "Cancel" button to erase that particular record?  Thanks for the help.
scrairAsked:
Who is Participating?
 
Jim Dettman (Microsoft MVP/ EE MVE)Connect With a Mentor President / OwnerCommented:
Use the Undo method

      ' Abandon the Edit
      ' Note that record may not be dirty if user manually did an undo.
      If frm.Dirty = True Then
        frm.Undo
      End If

Jim.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Ah I was using a form object variable there.  Change that to Me.Undo for it to work within the form.

Jim.
0
 
jack49aCommented:
The way I do something similar is to have the additions done in a working table.  This table is just like the big final table but without an autonumber.  Then if the user is happy with the record(s) there is a button on the form for the working table to append working table to final table and delete records in working table.  If the user is unhappy, there is another button which just deletes records in the work table (no append).

You can also use the working table idea if you are adding multiple records and want to set a default with effecting the big table.

Jack
0
 
DedushkaCommented:
Try to play with BeforeInsert event for your form, here you can cancel insertion of new record.
0
 
scrairAuthor Commented:
Thanks for all your help Jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.