Solved

Cancelling a new record

Posted on 2001-06-22
5
240 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:scrair
5 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 75 total points
ID: 6218946
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
 
LVL 57
ID: 6218952
Ah I was using a form object variable there.  Change that to Me.Undo for it to work within the form.

Jim.
0
 
LVL 2

Expert Comment

by:jack49a
ID: 6219540
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
 
LVL 7

Expert Comment

by:Dedushka
ID: 6221903
Try to play with BeforeInsert event for your form, here you can cancel insertion of new record.
0
 

Author Comment

by:scrair
ID: 6227755
Thanks for all your help Jim
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HasData 9 37
subtract 1 in Access 2003 query 7 39
Newbie needs help printing from a form. 10 20
Access Query based on a Form Field 2 20
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now