B
Baby Face Lee
Hi everyone
I'm sure it's me being dim but I can't see why I'm still getting a 2501
runtime error when the user wishes to cancel a DeleteRecord action.
Here's my code on the BEFOREDELCONFIRM event of the FORM:
Dim intResponse As Integer
intResponse = MsgBox("You are about to delete a Candidate record." _
& vbCrLf & "Any Components recorded for the Candidate will also be
deleted." _
& vbCrLf & vbCrLf & "Click on OK to proceed. This process cannot be
undone." _
& vbCrLf & vbCrLf & "Click on Cancel to exit the deletion process.", _
vbExclamation + vbOKCancel + vbDefaultButton2, "WARNING!!!")
If intResponse = vbCancel Then
Cancel = True
ElseIf intResponse = vbOK Then
Response = acDataErrContinue
End If
Here's my code in the ONCLICK event of the command button CmdDelete:
Private Sub cmdDelete_Click()
On Error GoTo Handle_Err
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
Handle_Exit:
Exit Sub
Handle_Err:
Select Case Err.Number
Case 2501
' the RunCommand action was cancelled.
Resume Handle_Exit
Case Else
MsgBox Err.Number & ": " & Err.Description _
& vbCr & "Please contact Linda Lawson.", _
"Unknown error"
Resume Handle_Exit
End Select
End Sub
How can I stop this error appearing?
Thanks for any help you can give.
Lee
I'm sure it's me being dim but I can't see why I'm still getting a 2501
runtime error when the user wishes to cancel a DeleteRecord action.
Here's my code on the BEFOREDELCONFIRM event of the FORM:
Dim intResponse As Integer
intResponse = MsgBox("You are about to delete a Candidate record." _
& vbCrLf & "Any Components recorded for the Candidate will also be
deleted." _
& vbCrLf & vbCrLf & "Click on OK to proceed. This process cannot be
undone." _
& vbCrLf & vbCrLf & "Click on Cancel to exit the deletion process.", _
vbExclamation + vbOKCancel + vbDefaultButton2, "WARNING!!!")
If intResponse = vbCancel Then
Cancel = True
ElseIf intResponse = vbOK Then
Response = acDataErrContinue
End If
Here's my code in the ONCLICK event of the command button CmdDelete:
Private Sub cmdDelete_Click()
On Error GoTo Handle_Err
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If
Handle_Exit:
Exit Sub
Handle_Err:
Select Case Err.Number
Case 2501
' the RunCommand action was cancelled.
Resume Handle_Exit
Case Else
MsgBox Err.Number & ": " & Err.Description _
& vbCr & "Please contact Linda Lawson.", _
"Unknown error"
Resume Handle_Exit
End Select
End Sub
How can I stop this error appearing?
Thanks for any help you can give.
Lee