enter data in one field and have it copy to another

G

Guest

I'd like to be able to enter a name into one field and have it copy into five
other fields. I then need to be able to change the data in any of the six
fields individually - i.e. - not have all six update if I need to change one
name.

Is this possible?

I know I can run an update query to copy all of the data at once, but as all
of the entries aren't added at the same time (it's a subscription series
where people join at different times), it would be more convenient for each
to update as the information is entered.

Thanks in advance.
 
M

ManningFan

In the After Update event of the textbox, set each textbox equal to the
one you updated. You might have to do it in the On Lost Focus event
instead, I can't remember if the After Update fires for each key you
press. Or maybe you stick an "Update" button on the form and in the On
Click event you can run the code.
 
J

John Vinson

I'd like to be able to enter a name into one field and have it copy into five
other fields. I then need to be able to change the data in any of the six
fields individually - i.e. - not have all six update if I need to change one
name.

Is this possible?

Yes, but the need to do this rather strongly suggests that your table
design may need work!

Are you perhaps storing a one to many relationship in a single record?
What are these six fields, and why would you want to store "the same"
information in all six?

If you really want to do so, you can use VBA code in the control's
AfterUpdate event to set the value of the other controls - but I
suspect that it's a Bad Idea.


John W. Vinson[MVP]
 
G

Guest

In the After Update event of TextBox1:
Me.TextBox2 = Me.TextBox1
Me.TextBox3 = Me.TextBox1
Me.TextBox4 = Me.TextBox1
Me.TextBox5 = Me.TextBox1
Me.TextBox6 = Me.TextBox1

Changing a value in 2 through 5 will not affect any of the others; however,
if you make a change to 1, it will replace the data in the other 5. If you
only want it to copy the data from 1 to the others, then you can do it this
way:

If Me.NewRecord Then
Me.TextBox2 = Me.TextBox1
Me.TextBox3 = Me.TextBox1
Me.TextBox4 = Me.TextBox1
Me.TextBox5 = Me.TextBox1
Me.TextBox6 = Me.TextBox1
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top