zeros

S

Susan

Hello,
Have 6 digit employee ID numbers in excel. Need to import
to table in access. They will be primary key. Majority
begin with 00. They are fine as "text" but when I change
to number, the zeros drop off. I am sure the answer is
simple but would appreciate your help.

As always, thank you for your time.
 
D

Douglas J. Steele

Leave them as text. Unless you're going to be doing arithmetic with them,
there's no reason for them to be numbers.
 
T

Tim Ferguson

Have 6 digit employee ID numbers in excel. Need to import
to table in access. They will be primary key. Majority
begin with 00. They are fine as "text" but when I change
to number, the zeros drop off. I am sure the answer is
simple but would appreciate your help.

I am going to take a different path to my esteemed co-responders. An
EmployeeID field is often used as a Foreign Key in other tables and as such
a (Long or) Integer will be easier to manipulate than a long text field.

So I'd stick with the numeric type. But remember that the number fifteen is
still the same value, whether it's expressed as 15, 000015, 15.00000, 5*3,
0x00FF, 00001111 or what. And it is that expression that you seem to be
worried about. If you want six digits with leading zeroes, then just use
the Format property on the text box on the form -- put in "000000". If you
should need to manipuate it like a text value, then it's easy to create a
query to do that:

SELECT "LON" & FORMAT(EmployeeID, "000000") AS Locator
FROM Employees
WHERE BaseCity = "London"

Just my 2p worth... :)


Tim F
 

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