I'm using a Access Xp 2002 and Keep getting this error when I delete a record. The error is Run Time Error 3021 "No Current record". The error started after I exported all my forms, queries and reports to a split off of the database. The delete still occurrs it just produces this error.
Any help would be greatly appriciated. Rich
Here is the code:
Private Sub StudentDelete_Click()
On Error GoTo Err_StudentDelete_Click
strMessage = "Are you sure you want to delete the student, " & [FirstName] & " " & [LastName] & " "
Style = vbCritical + vbYesNo
strTitle = "Delete Record?"
Response = MsgBox(strMessage, Style, strTitle)
DoCmd.SetWarnings False
If Response = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Else
Exit Sub
End If
DoCmd.SetWarnings True
Exit_StudentDelete_Click:
Exit Sub
Err_StudentDelete_Click:
If Err <> 3021 Then
MsgBox Err.Description
Resume Exit_StudentDelete_Click
End If
End Sub
Any help would be greatly appriciated. Rich
Here is the code:
Private Sub StudentDelete_Click()
On Error GoTo Err_StudentDelete_Click
strMessage = "Are you sure you want to delete the student, " & [FirstName] & " " & [LastName] & " "
Style = vbCritical + vbYesNo
strTitle = "Delete Record?"
Response = MsgBox(strMessage, Style, strTitle)
DoCmd.SetWarnings False
If Response = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Else
Exit Sub
End If
DoCmd.SetWarnings True
Exit_StudentDelete_Click:
Exit Sub
Err_StudentDelete_Click:
If Err <> 3021 Then
MsgBox Err.Description
Resume Exit_StudentDelete_Click
End If
End Sub