Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002

    Question Unanswered: Cancel Record Entry from form

    I'm creating a data entry form with the standard 'OK' and 'Cancel' buttons. 'OK' will simply close the form, capturing the record, but I want 'Cancel' to close the form and not capture the record. However, so far I've only been able to have it close and not capture the last entered field, but the incomplete or unwanted record is still added to the table.

    How can I get past this? Is this b/c the records I'm creating have an autonumber field that is being created immediately? I can setup a macro or event to delete the record on exit, but this seems to be the wrong way to go about it, plus I then have delete confirmations appearing and could be misleading or alarming to users.

  2. #2
    Join Date
    Jan 2003

    Here is one approach. The following code should be on the form's Before Update event:

    ' The Dirty property is True if the record has been changed.
    If Me.Dirty Then
    ' Prompt to confirm the save operation.
    If MsgBox("Do you want to save changes?", vbYesNo + vbQuestion, "Save Record") = vbNo Then
    End If
    End If


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts