The Command or Action "DeleteRecord" is not available now
Posted on 2004-09-01
I have a form ( Access 2003)where if the User makes a mistake or does not want to save a record he gets an option to exit without saving the record.
The Code in this part is as follows:
If IsNull(Me.City) Or Me.City = "" Then
msg = "You Must Enter a Contact City" & Chr(13) & "Do you want to exit without Saving this record"
style = vbYesNo
response = MsgBox(msg, style)
If response = vbYes Then GoTo DeleteRecord
If response = vbNo Then City.Locked = False: City.SetFocus: Exit Sub
DoCmd.Close acForm, "ContactData"
Clicking on Yes to action - DoCmd.RunCommand acCmdDeleteRecord produces a Runtime Error 2046
The Command or Action "DeleteRecord" is not available now.
This happens if it is a new record or an existing record.
The Allowdeletions Property is set to Yes and there are no fields in the Table that are required except the Record ID
Can any expert give me a pointer to what is going wrong??