CODE
Private Sub DeleteEntry_Click()
On Error GoTo Err_DeleteEntry_Click
If Me!SentToAccounts = True Then
MsgBox ("You cannot delete an entry that has already been sent to Accounts Department."), vbOKOnly
Exit_DeleteEntry_Click
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_DeleteEntry_Click:
Exit Sub
Err_DeleteEntry_Click:
MsgBox Err.Description
Resume Exit_DeleteEntry_Click
End Sub
On Error GoTo Err_DeleteEntry_Click
If Me!SentToAccounts = True Then
MsgBox ("You cannot delete an entry that has already been sent to Accounts Department."), vbOKOnly
Exit_DeleteEntry_Click
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_DeleteEntry_Click:
Exit Sub
Err_DeleteEntry_Click:
MsgBox Err.Description
Resume Exit_DeleteEntry_Click
End Sub
The code should check whether a yes/no check box is checked. If it is, it displays an error message and quits the module.
If it is not checked, it should delete the record.
Sorry in advance for any school-boy errors in this!
Yours,
Alton.