Change Table Field Number to Text

F

franklinbukoski

I have a database at work I inherited which uses SSN as the primary field in
a table, stored as a number.

I'd like to change it to a text field without losing any data. When I tried
this on a copy of the db, everyone's SSN that started with 0 lost the zeros.
The number then gets stored as if it moved to the left, so when you view the
SSN it goes from
00abcdefg to
abcdefg
 
K

Ken Sheridan

Use an update query to update the SSN field to:

Format([SSN],"000000000")

This will put in the leading zeros.

KenSheridan
Stafford, England
 
O

Ofer Cohen

If you open the old table, and the SSN has leading zero's it can be:
1. The type of the field is already text, numeric fields can't have leading
zero's
2. In the field format property there is 0000000, that make leading zero's
apear.
If that the case, you can add the format to the new table
 
F

franklinbukoski

Thank you all so much!

Ofer Cohen said:
If you open the old table, and the SSN has leading zero's it can be:
1. The type of the field is already text, numeric fields can't have leading
zero's
2. In the field format property there is 0000000, that make leading zero's
apear.
If that the case, you can add the format to the new table
 

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