I have a command button which terminates entering a new record being created. I put my code in where I think the record has started being created, ie the first field has data entered, its autotab is set to true and goes to the next control. Its then I hit a button with code as below. However it sometimes seems to remove/cancel the record and sometimes not. Using messageboxes I was trying to debug it but maybe I am using the event incorrectly? Thanks
In a button on_click
If Me.Dirty = True Then
MsgBox "Dirty"
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
If Me.Dirty = False Then
MsgBox "Not Dirty"
End If: End If
In a button on_click
If Me.Dirty = True Then
MsgBox "Dirty"
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
If Me.Dirty = False Then
MsgBox "Not Dirty"
End If: End If