Hi again Paul
How are you getting the value in there in the first place? Is it the
default value?
If so, then you could say:
AssignedTo = AssignedTo.DefaultValue
If not (say you're loading the value in the Form_Load or Form_Current event
procedure) you could either save the value in a module-level variable:
<declarations section>
Dim mstrOriginalAssignedTo as String
<Form_Load>
mstrOriginalAssignedTo = <some string expression>
AssignedTo = mstrOriginalAssignedTo
<code where you want to undo>
AssignedTo = mstrOriginalAssignedTo
Or, you could store the original value in the control's Tag property:
AssignedTo.Tag = <some string expression>
...
AssignedTo = AssignedTo.Tag
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Paul B. said:
Thanks Graham,
Can you provide more details as to how to do this. I am having a little
difficulty wrapping my head around variables, when to use them etc. If you
could give me a sample as to when to save a variable prior to the user
actually attempting to make the change, it would help me understand the
process.
Thanks again.
:
Hi Paul
If the textbox is unbound, then you must save the original value and
restore
it yourself.
Me.AssignedTo = strOriginalAssignedTo
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Hi Graham,
The text box is unbound. As far as being dirty, I thought using the
OnExit
event would allow me to capture whether or not the user actually wanted
to
change to value (not normally done for this field, but there as an
option).
Thanks.
:
Hi Paul
If AssignedTo is a bound textbox, then .Undo should return it to its
original value *unless* the record has been saved in the meantime.
Are you sure that (a) the textbox is bound and (b) the record is still
dirty
from the user changing the value?
--
Graham Mandeno [Access MVP]
Auckland, New Zealand
I need some help in returning the value of a text box following the
OnExit
Event.
I have a text box [AssignedTo] that has a default value pulled from
a
table
not related to the form.
I am using a DoCmd.SQL Update statement if the user selects OK to
accept
the
change.
However, if they cancel, I need to return the text box to the
default
value.
If have tried....
Me.AssignedTo.Undo
and
Me.Requery (because of the rules around other required fields, this
won't
work without causing error messages)
Any ideas would be appreciated.
Cheers