Croy,
If you are editing the value in a control, and that control has the focus,
then the Value property of the control will return what was in the control
before you started typing. Once you leave that control, the controls value
you typed into the control will be accessable through the Value property,
and the value that was there before you made any changes will be in the
OldValue property.
These values are not actually written to the record and the record saved
until you either move to another record, or save the record you are on
(setting the forms Dirty property to False forces Access to write that
record). If you cancel your changes (Hit the Escape key) or issue a me.Undo
command, Access will set the Value of the control equal to the OldValue of
that control.
If you return the focus to a control (txtMyField.SetFocus), then the .Text
property will contain the same value as the the .Value property.
Try this,
Create a new table and give it 2 text fields
Create a new form, bound to the table you just created.
Add two textboxes (txtMyField1, and txtMyField2) and bind the controls to
the fields in the forms recordsource.
Set the forms cycle property to "Current Record"
Add the following to the Forms code module:
Private Sub txtMyField1_GotFocus
msgbox "Value:" & me.txtMyField1.Value & vbcrlf _
& "Text:" & me.txtMyField1.Text & vbcrlf _
& "OldValue:" & me.txtMyField1.OldValue
End Sub
Private Sub txtMyField1_Change
msgbox "Value:" & me.txtMyField1.Value & vbcrlf _
& "Text:" & me.txtMyField1.Text & vbcrlf _
& "OldValue:" & me.txtMyField1.OldValue
End Sub
Private Sub txtMyField2_GotFocus
msgbox "Value:" & me.txtMyField1.Value & vbcrlf _
& "Text:" & me.txtMyField1.Text & vbcrlf _
& "OldValue:" & me.txtMyField1.OldValue
End Sub
Now, place your cursor int txtMyField1. You will get a messagebox
displaying all of the above values
Now, type a couple of characters. You will get a messagebox after each
character is pressed showing you the values in each of the fields
Now, tab into the next textbox, you will now see the values again, as they
exist after you have departed that control
Now tab again, should take you back to txtMyField1, on the same record, and
will display all three values again.
HTH
Dale