Results 1 to 8 of 8
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Delete Record (2002)

    Code help?

    <pre>Private Sub cmdDeleteCurrentRecord_Click()
    On Error GoTo Err_DeleteCurrentRecord_Click
    If MsgBox("It is EXTREMELY unusual to completely delete a record. Continue?", _
    vbYesNo + vbQuestion, _
    "This record will be completely removed from the database!!") = vbYes Then
    If MsgBox("Are You Absolutely Sure You Want to Delete This Record?", _
    vbYesNo + vbQuestion, _
    "Last chance!!") = vbYes Then
    DoCmd.SetWarnings False
    RunCommand acCmdDeleteRecord
    DoCmd.SetWarnings True
    End If
    End If
    Exit Sub

    Err_DeleteCurrentRecord_Click:
    MsgBox Err.Description, vbExclamation
    End Sub</pre>


    (My apologies for the Gates-like redundancy - the customer is always "right")
    When clicking yes on the second question I get the attached "error". It still deletes the record.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Delete Record (2002)

    The code in itself is OK, so the error must be caused by something else. Do you have event procedures for the On Delete, Before Del Confirm, After Del Confirm, or On Current event of the form?

  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Delete Record (2002)

    Hans:

    This is the same db I was working on yesterday for my church. The only "form" event is On Current:
    <pre>Private Sub Form_Current()
    If [blnWarrior] = True Then
    [ImgWarrior].Visible = True
    Else
    [ImgWarrior].Visible = False
    End If
    Me.cboTeamNo.Enabled = Not blnDropped
    End Sub</pre>


    The first part is to show/hide an image, and the second is a portion you gave me to disable cboTeamNo when blnDropped is checked.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Delete Record (2002)

    Try the following (I'm not sure it wil work, but it's worth a try):
    - Temporarily make the line

    On Error GoTo Err_DeleteCurrentRecord_Click

    into a comment by inserting an apostrophe <code>'</code> in front of it. When you click the button, you should now get a Debug option in the error message. If you click Debug, which line is highlighted?

  5. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Delete Record (2002)

    <span style="background-color: #FFFF00; color: #000000; font-weight: bold">RunCommand acCmdDeleteRecord</span hi>
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Delete Record (2002)

    I'm afraid it's impossible to say what's happening without seeing the database.

  7. #7
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Delete Record (2002)

    Hans:

    Sorry for the delay (I forgot about a 06:00 meeting this morning)
    I removed the On Current event just to see what would happen - no difference.
    Will try to convert to '97 and zip later today.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  8. #8
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Delete Record (2002)

    I guess I found the problem, but don
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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