I'm trying to create a button that will cancel/erase data entered on a NEW record, and close the form without saving, but only on a new record that has not been finished or closed yet.
Currently I have something that works, but not exactly in the manner explained above...
Private Sub Form_BeforeUpdate()
If Form.Dirty Then
If MsgBoxYesNo(CancelOrderPrompt) Then
Me.Undo
End If
End If
End Sub
That prompts me if I want to save whenever I close the form regardless if it is a new record or existing record that has been changed.
I would only like for it to prompt me if it is a NEW record that has not been saved/closed yet, and ignore existing records that have been modified.
Then I would like to disable the button for all other records that are NOT NEW. Something like... (I would need the correct syntax here)
Private Sub Form_Load()
If "current record is not new" Then
Me.cmdCancelOrder.Enabled = False
End If
End Sub
Any help would be much appreciated!
Currently I have something that works, but not exactly in the manner explained above...
Private Sub Form_BeforeUpdate()
If Form.Dirty Then
If MsgBoxYesNo(CancelOrderPrompt) Then
Me.Undo
End If
End If
End Sub
That prompts me if I want to save whenever I close the form regardless if it is a new record or existing record that has been changed.
I would only like for it to prompt me if it is a NEW record that has not been saved/closed yet, and ignore existing records that have been modified.
Then I would like to disable the button for all other records that are NOT NEW. Something like... (I would need the correct syntax here)
Private Sub Form_Load()
If "current record is not new" Then
Me.cmdCancelOrder.Enabled = False
End If
End Sub
Any help would be much appreciated!