Hi Again
I have been using the following code to delete records from my database for some time but for some reason this code now gives me the runtime error 3021 - no current record.
It may be wishful thinking but I think it may be a microsoft issue because if I create a new form and copy/paste in all data from old form I don't have this problem:
My code I am using is:
Private Sub Delete_Record_Click()
DoCmd.SetWarnings False
strMessage = "Are you sure you want to delete the Season " & [SeasonName].Column(1) & " "
Style = vbCritical + vbYesNo
strTitle = "Delete Record?"
Response = MsgBox(strMessage, Style, strTitle)
If Response = vbYes Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.Requery "SeasonName"
SeasonName = Me.SeasonID
Else
Exit Sub
End If
End Sub
The runtime error appears at the "DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70" line
Can anybody help me out with this?
I have been using the following code to delete records from my database for some time but for some reason this code now gives me the runtime error 3021 - no current record.
It may be wishful thinking but I think it may be a microsoft issue because if I create a new form and copy/paste in all data from old form I don't have this problem:
My code I am using is:
Private Sub Delete_Record_Click()
DoCmd.SetWarnings False
strMessage = "Are you sure you want to delete the Season " & [SeasonName].Column(1) & " "
Style = vbCritical + vbYesNo
strTitle = "Delete Record?"
Response = MsgBox(strMessage, Style, strTitle)
If Response = vbYes Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.Requery "SeasonName"
SeasonName = Me.SeasonID
Else
Exit Sub
End If
End Sub
The runtime error appears at the "DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70" line
Can anybody help me out with this?