Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disallow Deletes (Access 97)

    I have an app where if a user wants to delete a record, we don't want them to.

    I have the following code: <pre>Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    MsgBox "No, no, no..." & vbNewLine & vbNewLine & _
    "You are not allowed to delete records.", vbCritical, "Please don't delete me!"
    DoCmd.CancelEvent
    DoCmd.SetWarnings False
    DoCmd.RunSQL "INSERT INTO tblDeletes VALUES('" & GetUser & "',#" & Now & "#," & Forms![frmEditMailRecords].RefNum & ")"
    DoCmd.SetWarnings True
    'Me.TimerInterval = 1000
    End Sub</pre>



    When the users click the Delete Record button in the menubar I get the message box, but the record still gets deleted.

    Any ideas?

    Thanks!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Disallow Deletes (Access 97)

    Set the Allow Deletes property of the form to No, then the Delete Record toolbar button and menu option will be disabled.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Disallow Deletes (Access 97)

    And now I'm kicking myself!!!

    Thank you!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

Posting Permissions

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