I need to combine to fields in a table to populate a third field

G

Guest

I have two fields that need to be concatenated to form a third field which is
used as a primary field. The data for the first two fields is typed in on a
form, and the combined data needs to be added to the table.
 
D

Duane Hookom

Why not just store the two values in two fields? Storing a calculated value
is rarely justified and mostly unnecessary.
 
C

Corey-g via AccessMonster.com

This would depend on how you wanted to handle this, either in the text box,
or using VBA code.

If you had 3 textboxes, you could do this as the control source of the 3rd
textbox:
=[textbox1]+[textbox2]

If you are using VBA, using whatever event procedure that works for you, you
simply use:
me.textbox3.value = me.textbox2.value & " " & me.textbox2.value

HTH

Corey
 
J

John Vinson

I have two fields that need to be concatenated to form a third field which is
used as a primary field. The data for the first two fields is typed in on a
form, and the combined data needs to be added to the table.

No, it doesn't, almost certainly.

You can make two fields (or ten fields for that matter) a joint
Primary Key by ctrl-clicking the fieldname in table design so that
they are both selected and then clicking the Key icon.

It is neither necessary nor desirable to store the information in the
two fields redundantly in a third field.

John W. Vinson[MVP]
 

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