Form adds record on Close

PRD

Registered User.
Local time
Today, 15:07
Joined
May 18, 2011
Messages
72
Hello, I created a Form to add records to a Table (Data Mode = 'Add'). After I open the Form (using the 'OpenForm' command) I intialize several fields and I have a 'SaveRecord' Command Button to save the records.

My problem is if a user opens the Form and then immediately exits (using the 'Close' command) without entering any data Assess adds a blank record to the Table. And so my question is, how can I prevent Access from adding a record when the Form is closed? Thank you for your time.
 
Run a delete query to delete that record
 
G37Sam -

I was thinking of writing a Module to delete the record but figured Access might just have a switch to turn off the 'Add'. The DeleteQuery would work better than the Module, thanks for your help.
 
Yeah the thing with Access is that it adds a new record the moment any sort of data is entered into a record whether manually or using VBA. You can look into undo's and hitting the sendkey "{esc}" but the most reliable way to do it would be a deletequery or running an SQL command
 

Users who are viewing this thread

Back
Top Bottom