Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    surpress system message (access 2003)

    this code is in "on click" on the command button.

    This code with create a custom message box and delete the record, but it doesn't stop the system message from showing also. I have to answer yes to the custom box, then answer yes to the system message to delete the record. How do I suppress the system message and only show my message?
    I'm not real good at this (if you can't tell), so please answer in simple terms <img src=/S/smile.gif border=0 alt=smile width=15 height=15> !


    Private Sub DelInquiry_Click()
    Dim myresp As Integer
    myresp = MsgBox("You are about to delete the record for" & [LFNAME] & " " & Chr(13) _
    & [LLNAME] & ", are you sure you want to delete this record?" & Chr(13) _
    & "You will not be able to undo if you say YES.", 4, "My Company Name - Warning!")

    If myresp = vbNo Then
    Cancel = True
    End If
    If myresp = vbYes Then
    DoCmd.RunCommand acCmdDeleteRecord
    End If
    End Sub

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: surpress system message (access 2003)

    Hi, try the following:
    Private Sub DelInquiry_Click()
    Dim myresp As Integer
    myresp = MsgBox("You are about to delete the record for" & [LFNAME] & " " & Chr(13) _
    & [LLNAME] & ", are you sure you want to delete this record?" & Chr(13) _
    & "You will not be able to undo if you say YES.", 4, "My Company Name - Warning!")
    If myresp = vbNo Then
    exit sub
    End If
    If myresp = vbYes Then
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdDeleteRecord
    DoCmd.SetWarnings True
    End If
    End Sub

  3. #3
    New Lounger
    Join Date
    Feb 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: surpress system message (access 2003)

    It worked like a charm. Thanks a lot!

Posting Permissions

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