View Full Version : Setting a table field value based on the concatenation of 2 other field values


paternl
03-26-2003, 08:41 PM
I have a simple question. Is there a way to take 2 or more table field values to create the value for another field?

I.e., I have a table named Procs with 3 ComboBox fields: CodA, CodB, and CodC. Each field is text of 2 characters. I have one other field called Concatenation that is text of 6 characters that I want to store the concatenation of the 3 ComboBox fields that are selected. I cannot figure out how to do this simple thing. I have tried unsuccessfully to use the Default value property of Concatenation (=[CodA] & [CodB] & [CodC] ).

This doesn't work. I want to store this result in a table--not on a Form. I can do this easily using a Form.

Thanks for any insights!

Pat Hartman
03-26-2003, 09:43 PM
You really should NOT be storing this in the table. Do it in a query whenever you want to show the concatenated value. You can use queries in place of tables for just about everything.

paternl
03-27-2003, 06:47 AM
OK, but I'd like to lookup this value (6 character concatenation) often and easily and then append a 2-digit 1-up index number to it, keeping the 8-digits unique.

I need the resultant 8-character string for a unique test procedure name on another system. I need a record of all our unique test procedures....

E.g., ProcNames=10CY1S01, 10CY1S02, 01FO1T01, etc.

It just seems like it should be easy to do in a table and more efficient than using a Query or a Form. Why shouldn't this be something I can do in a table?

Thx!

Mile-O
03-27-2003, 06:56 AM
Originally posted by paternl
It just seems like it should be easy to do in a table and more efficient than using a Query or a Form. Why shouldn't this be something I can do in a table?

...because there is no benefit to storing it in a table. What you are suggesting is duplicating your data when there is no need to. You have the base values and by using a query you can arrive at the concatenated conclusion anytime.

paternl
03-27-2003, 07:35 AM
Thank you. I will try the query route!