concatenate two fields to generate primary key?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Have looked for this in the forum but with no luck

I have two fields in a database

1) Form_No (example value "FT001")
2) Time_Of_Call (example "23:30")

There are several calls per form, so the table will have several rows for
FT001, but each with a different time.

What I want to do is to create a third field which will concatenate these
two to generate a key for that record i.e FT0012330

Is this possible? if so how? and will the second field being a Time/Date
format cause problems?
 
Matt

Don't bother! If you already have two fields containing the data you need,
create a primary key spanning those two fields.

Good luck

Jeff Boyce
<Access MVP>
 
I managed to do this - but realised that I actually I wanted this extra field
to be a value I could use when joining to other tables - is that still
possible?
 
I wanted this extra field
to be a value I could use when joining to other tables - is that still
possible?

Use two fields as the foreign key in the other tables too.

If you created this extra concatenated field in the first table, there is
simply no way to guarantee that it will always keep up to date with the
original two. What do you make of a record that is made up of:

"FT032", #13:37#, "TF0321336", ...?


All the best

Tim F
 
Okay, not quite sure what you meant about the keeping up to date bit, but
will have a crack at using the key across both fields. Thanks for your help,

Matt
 
Back
Top