Filling a field from a primary key

G

Guest

I have a primary key that is based on SSN's. I have an external system that
uses the last five digits for a ID number. I need to have the ID for the
external system (which is a field in my table) to populate automatically
from the primary key.

Any suggestions would be appreciated.
 
G

George Walsh

If you have a field named SSN in a table which contains the Social Security
Number (say it does not include dashes, just digits - but it is formatted as
a string rather than a number), and you want another field in your table to
automatically populate with just the rightmost five digits from the Social
Security Number field, then you could design and use a query which is based
on your table, and use the calculated field method to create a field named
"ID Number" with the formula: ID Number: =
Right$([MyMainTableName]![SSN],5). Design your forms, reports, etc. using
the Query rather than the Table, and the (separate) automatically calculated
"ID Number" field will be available for every record.

The logic is to minamalize the fields of data you actually store in a
table - especially when one field can be derived from another and is not an
absolutely unique piece of information relating to the subject of the table.
 
G

George Walsh

If you have a field named SSN in a table which contains the Social Security
Number (say it does not include dashes, just digits - but it is formatted as
a string rather than a number), and you want another field in your table to
automatically populate with just the rightmost five digits from the Social
Security Number field, then you could design and use a query which is based
on your table, and use the calculated field method to create a field named
"ID Number" with the formula: ID Number: =
Right$([MyMainTableName]![SSN],5). Design your forms, reports, etc. using
the Query rather than the Table, and the (separate) automatically calculated
"ID Number" field will be available for every record.

The logic is to minamalize the fields of data you actually store in a
table - especially when one field can be derived from another and is not an
absolutely unique piece of information relating to the subject of the table.
 
G

Guest

Thank you. That worked great.

George Walsh said:
If you have a field named SSN in a table which contains the Social Security
Number (say it does not include dashes, just digits - but it is formatted as
a string rather than a number), and you want another field in your table to
automatically populate with just the rightmost five digits from the Social
Security Number field, then you could design and use a query which is based
on your table, and use the calculated field method to create a field named
"ID Number" with the formula: ID Number: =
Right$([MyMainTableName]![SSN],5). Design your forms, reports, etc. using
the Query rather than the Table, and the (separate) automatically calculated
"ID Number" field will be available for every record.

The logic is to minamalize the fields of data you actually store in a
table - especially when one field can be derived from another and is not an
absolutely unique piece of information relating to the subject of the table.

graffbp said:
I have a primary key that is based on SSN's. I have an external system
that
uses the last five digits for a ID number. I need to have the ID for the
external system (which is a field in my table) to populate automatically
from the primary key.

Any suggestions would be appreciated.
 

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