Copy Values between Text Boxes in Forms

  • Thread starter Thread starter aulttim
  • Start date Start date
A

aulttim

How do I get text box "B" to read the value entered into text box "A"
while maintaining the control source of text box "B" as its field in
the table?

I want to copy the value from text box "A" to appear in text box "B"
after the user leaves focus of text box "A". (The user can optionally
change the data in text box "B" when the focus is there.) Values from
both text boxes are added to their respective unique records when user
clicks 'add record' control.

Help?
 
I'm confused. It sounds like you want the value in one field (via textboxA)
copied into a second field (via textboxB). Why?

Trying to do this suggests that the underlying data structure may not be
well-normalized (i.e., more like a spreadsheet than a relational database).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Jeff:

Two values are required from the user. The "A" value may be the same
as the "B" value, but not always. So when looking at the table, records
in the respective fields for A and B may be the same or unique.

I'd like to save the user time from having to enter data twice by
pre-populating the "B" text box with the value read from the "A" text
box. (There is also a human factors element in doing it this way.) The
user can enter different data into the "B" text box if necessary.

Setting the control source with '=FieldName_of_A' works, but the record
is not updated. Setting default value with '=FieldName_of_A' does not
work. Setting an event against an object seems the likely course, but I
cannot get anything to work correctly.

I'm not certain how this could be normalization issue, but I'm all ears
to any suggestions that might resolve this seemingly simple problem.

Tim.
 
I may be reading too much between the lines. If the same value would be
appropriate in Field1 and Field2, I wonder why. Perhaps if you provide a
real-world (your world) example, I'd better understand. My comment on
normalization is based on my uncertainty.

Try this...

In the AfterUpdate event of textboxA, add the following expression:

Me!textboxB = Me!textboxA

Note that this will fire EVERY TIME a change is made in textbox A. Is that
what you want to have happen?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top