copy from text box to text box

copy from text box to text box

Post by UGF1b » Sat, 12 Jan 2008 01:20:02


I need to automatically/immediately copy a value on my form entered into a
text box to another text box on the same form. The value should copy over
every time the original value changes. The text boxes are both short date
values.

Example:
Text_Box_A changes FROM null TO 1/10/08, then Text_Box_B changes FROM null
TO 1/10/08
If Text_Box_A changes FROM 1/10/08 TO 1/17/08, then Text_Box_B changes FROM
1/10/08 TO 1/17/08

and so on....

Thoughts? I've tried using an AfterUpdate macro using 'SetValue' of
Text_Box_B equal to Text_Box_A but that is not working - no matter what I
type in Text_Box_A, nothing is every being populated in Text_Box_B.

Thanks!
 
 
 

copy from text box to text box

Post by UGF1b » Sat, 12 Jan 2008 01:40:02

FYI...I can get it to work if I put in the following code on the 'Close'
button:

me.text_box_b = me.text_box_a

But, I would really like it to work as an AfterUpdate or Change event in the
text_box_a field, which the same code tied to them doesn't work.

Thanks

 
 
 

copy from text box to text box

Post by S2xhdHV » Sat, 12 Jan 2008 04:59:03

First, avoid using the Change event. It will fire on each keystroke, which
is probably not what you want. You could use the After Update event IF you
only want text box b to change when text box b is changed manually by the
user. You code will work in the After Update event.

me.text_box_b = me.text_box_a
--
Dave Hargis, Microsoft Access MVP