Best strategy for deleting unwanted record?

G

Guest

I have a subform with controls bound to DonorTbl. When a user enters data in
any field, it creates a new record. Sometimes the user wants to cancel the
operation and delete the partially completed record. What are the best steps
for doing that? Everything I have tried so far has left me with a partially
completed record.

Thanks in advance.
 
G

Guest

I don't know if it's the best strategy, but two ways to do that
And you need to remember that the second the cursor moved from the sub frm
to the main form, the record in the sub form will be saved.

1. Press ESC twice, will remove partial data, as long that it is not saved
yet.

2. On the Before update event of the sub form create the code
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("D you want to save the record", vbYesNo) = vbNo Then
Cancel = True
Me.Undo
End If
End Sub

3. To do that from the main form using a button, you need to run delete SQL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top