J
Jon A
I have a bunch of controls on my form, and the state of each
control is based on the state of the overall form. That is,
when the status of the record is "Open" then certain
controls are enabled and certain others are disabled. When
the status of the record is "Closed" then just about all the
controls are disabled, etc., etc.
The controls consist of mostly text boxes, but there are
some command buttons also and a couple of combo boxes.
My problem is when I hit the ESC key to perform an Undo.
The data in all the controls get reset correctly to their
original values. But not all the controls do.
I have a procedure that gets called on Form_Current,
Form_AfterUpdate, Form_Undo, etc. It works to correctly
reset the controls all the other times but not with Undo.
When I go to the debugger and place a breakpoint in that
procedure I can check the values of the control variables.
The controls all seem to hold the new value that was typed
in rather than the original value that shows on the screen.
For example, if a text box was empty when I opened up the
form, then I type something in it, then I hit ESC - the text
box control on the form shows that it has nothing in it.
But then when I break and hold the cursor over the variable
Me![MyTextBox] in the code, it shows the value that was
typed in when it should be NULL.
As a result, when I perform the checks to setting the state
of the controls by doing things like:
if IsNull(Me![MyTextBox]) Then...
the wrong branch of the code executes and the control states
are wrong.
Is there some special way that I have to check the contents
of controls after hitting the ESC key?
control is based on the state of the overall form. That is,
when the status of the record is "Open" then certain
controls are enabled and certain others are disabled. When
the status of the record is "Closed" then just about all the
controls are disabled, etc., etc.
The controls consist of mostly text boxes, but there are
some command buttons also and a couple of combo boxes.
My problem is when I hit the ESC key to perform an Undo.
The data in all the controls get reset correctly to their
original values. But not all the controls do.
I have a procedure that gets called on Form_Current,
Form_AfterUpdate, Form_Undo, etc. It works to correctly
reset the controls all the other times but not with Undo.
When I go to the debugger and place a breakpoint in that
procedure I can check the values of the control variables.
The controls all seem to hold the new value that was typed
in rather than the original value that shows on the screen.
For example, if a text box was empty when I opened up the
form, then I type something in it, then I hit ESC - the text
box control on the form shows that it has nothing in it.
But then when I break and hold the cursor over the variable
Me![MyTextBox] in the code, it shows the value that was
typed in when it should be NULL.
As a result, when I perform the checks to setting the state
of the controls by doing things like:
if IsNull(Me![MyTextBox]) Then...
the wrong branch of the code executes and the control states
are wrong.
Is there some special way that I have to check the contents
of controls after hitting the ESC key?