Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation Field in Table - Need Help 1

Status
Not open for further replies.

HisEnergy

Programmer
Sep 25, 2006
5
US
I have a Contact file with Last Name and First Name Field in them. I would like another field that will concantenate these two in a third field automatically I will call Full Name.

Having trouble setting up the Full Name field. I sure this is a Calculation.

How do I set this up?

Thanks

 
In a query you could concatenate...

FullName:FirstName & " " & LastName
 
Creating the 3rd field in a table is not recommended because this would simply be duplicated data. I suggest performing the concatenation at the time it's needed. This can be done in a query, something like...
Code:
SELECT FirstName & " " & LastName AS FullName
FROM yourTableName


Randy
 
randy700: Assuming I really do require this concatenation (to create a unique primary key, let's say), how would I go about doing it?

I'd like to have three fields exactly like HisEnergy describes. I do not care about duplication of data.

Thanks
 
to create a unique primary key
No need of new concatened field for this purpose.
Simply create a composite primary key.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Okay, I'll bite.

I think I understand the concept of a composite key but have no clue how to accomplish it. Care to illuminate the subject?

:D

Thanks
 
Go into Design View for the table. If you already have a Primary Key, select the field, right click and click on Primary Key. Now that you have no Key selected, select both fields for your composite Key, right click anywhere in the hi-lited area, right click and click on Primary Key. You should now see the key icon to the left of both fields.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
missingling,

Okay, that's step one. I assume step two would be to drag a relationship from -both- fields over to the other table. Step three would be to use a combo box in table2 so that the user would be able to select a name (which would have to show both FirstName and LastName) from table1.

Perhaps you might have an example database showing how a composite key is used to ensure referential integrity?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top