Do not add record

Gorio

Registered User.
Local time
Today, 16:19
Joined
Sep 26, 2000
Messages
33
I'm trying to write what must be simple code. Quit simply, when the user want to close a form, do they want to save this new record or not? I've gotten this far, but am not sure how to discard all the entries on this new record. There is one link to another table on this form. This form holds the many of a one to many.

Private Sub cmdClose_Click()

Dim msgSave As Variant

msgSave = MsgBox("Do you wish to save this Class Info?", _
vbYesNoCancel, "Save Class Info")

If msgSave = vbYes Then
DoCmd.Save
Exit Sub
ElseIf msgSave = vbNo Then
docmd.??????
ElseIf msgSave = vbCancel Then
Exit Sub
End If

End Sub
 
I haven't tried this, but it should work. Try using this code where the user selects to not save the new record:

SendKeys "{ESC}" 'Clear current field
SendKeys "{ESC}" 'Clear current record
DoCmd.Close

Darrin - CB69
 
Either Me.Undo or SendKeys"{ESC}","{ESC}"
 

Users who are viewing this thread

Back
Top Bottom