Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Dec 2006
    Thanked 0 Times in 0 Posts

    Deleting a record (2003)

    I have a form where I created a command button using the toolbox and wizard to delete a record. However, I want to give a warning to the user in form of a message ("Are you sure you want to delete this invoice", vbyesno). I also notice that when I delete a record, I get a message box about relationship and cascading and if I want to delete these records on the associated tables too. How can I prevent this screen from showing? Any help would be great. Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: Deleting a record (2003)

    You can add this code at the beginning of the On Click event procedure for the button:

    If MsgBox("Are you sure you want to delete this invoice?", vbYesNo + vbQuestion) = vbNo Then
    Exit Sub
    End If

    To suppress the built-in warnings generated by Access, insert this line above the lines with DoCmd.DoMenuItem:

    DoCmd.SetWarnings False

    and immediately above the line with Exit Sub, insert

    DoCmd.SetWarnings True

Posting Permissions

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