I have a form bound to a table, then filtered to show 1 record.
If I change a field on the form, and close the form with the x, the changed data saves to the table.
If I close the form programmatically from the OnKeyPress event, it doesn't save.
Strangely, if I select Records > Save Record, then close, it does save....
What am I missing?
If I change a field on the form, and close the form with the x, the changed data saves to the table.
If I close the form programmatically from the OnKeyPress event, it doesn't save.
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, "frm Customer Card"
End If
End Sub
Strangely, if I select Records > Save Record, then close, it does save....
What am I missing?