I have a datasheet form (viewing only) that has a buttons to edit or add records. When you click the add record button, a new form will open and one of the fields (a field that needs consecutive numbering) is filled in from code using
DMax("[field]", "table") + 1
The textbox for this field is locked so it cannot be changed. However, when I press the escape button, the field gets emptied. Locking and/or disabling the textbox has no effect.
I found I can prevent the emptying of the field when escape is pressed by putting 'cancel = true' in the forms undo event, but that seems like overkill to me, because it disables every undo action.
My other thought was to monitor key presses and just refill the field after escape is pressed, but the keypress, keydown en keyup events do not seem to fire.
Is there a way to prevent the field from emptying when escape is pressed while allowing undo?
DMax("[field]", "table") + 1
The textbox for this field is locked so it cannot be changed. However, when I press the escape button, the field gets emptied. Locking and/or disabling the textbox has no effect.
I found I can prevent the emptying of the field when escape is pressed by putting 'cancel = true' in the forms undo event, but that seems like overkill to me, because it disables every undo action.
My other thought was to monitor key presses and just refill the field after escape is pressed, but the keypress, keydown en keyup events do not seem to fire.
Is there a way to prevent the field from emptying when escape is pressed while allowing undo?