Question Delete a half finished record

kballing

I do stuff
Local time
Today, 10:34
Joined
Nov 17, 2009
Messages
51
First, a bit about the data:
Each record has a unique key (autonumber), and an ItemID (text) that is not necissarily unique nor required, as well as various item information. It is possible that an item with the same ItemID may come through the system to be reprocessed. This would mean either a new record with a new key and same ItemID, or update an existing record using the same key and ItemID. Both are possibilities.

Next, the data entry form:
The ItemID has a BeforeUpdate event which checks for existing records with the same ItemID. If matching records are found, a pop-up form allows you to select one of the existing records to edit. Afer a record is selected, it returns to the data entry form and moves to the desired record for editing.

The problem:
Suppose someone begins entering data in the form and enters the ItemId after half completing the form. The ItemID matches existing records and they choose to edit an existing record instead of create a new one. The data entry form moves to the selected record, however the half entered record from the beginning is saved.
Is there a way to discard the previously entered data before moving records?
Currently I have a DoCmd.MenuItem to delete the previous record, but then a nag message comes up asking if I am sure I want to delete the record. Is there a way to silently delete the record?
 
Code:
DoCmd.SetWarnings False

Set it to False to turn the warnings off. Make sure to turn the warnings back on when you're done.
 
Ok, that works.

I'm still curious if anyone has other approaches to this.
 
You can point from the orphaned record to the "real" record.

You can delete it via ADO or DAO.

You can disallow duplicates in the first place.

There are probably more ways to do this than there are people on these forums.
 
You could use the Undo command to delete the half finished record.
Or make the form for the new record unbound and only save it at the completion of the record.

As George says, lots of possibilities.
 
Thanks for the ideas all. For only being intorduced to access a week or two ago, I'm learning a ton.
 

Users who are viewing this thread

Back
Top Bottom