M
Mike Revis
I have the following code on my form to delete the current record.
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
DoCmd.RunCommand acCmdDeleteRecord
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
'Suppress No Current Record message
If Err.Number = 3021 Then
Resume Exit_cmdDelete_Click
Else
MsgBox Err.Description
End If
End Sub
When I click the button I get the standard Access message about "are you
sure you want to delete?".
If I click yes everything proceeds as expected.
If I click no I get an error message as follows.
Microsoft Access can't find the field '|' referred to in your expression.
If I comment out the
'Else
'MsgBox Err.Description
I do not get the error message. I'm pretty sure that's because I commented
it out.
As always any thoughts, comments or suggestions are welcome.
Best regards
Mike
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
DoCmd.RunCommand acCmdDeleteRecord
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
'Suppress No Current Record message
If Err.Number = 3021 Then
Resume Exit_cmdDelete_Click
Else
MsgBox Err.Description
End If
End Sub
When I click the button I get the standard Access message about "are you
sure you want to delete?".
If I click yes everything proceeds as expected.
If I click no I get an error message as follows.
Microsoft Access can't find the field '|' referred to in your expression.
If I comment out the
'Else
'MsgBox Err.Description
I do not get the error message. I'm pretty sure that's because I commented
it out.
As always any thoughts, comments or suggestions are welcome.
Best regards
Mike