Importing SSNs from Excel into access 2007 and using as primary ke

B

Bhuyler

I've been beating my head against the wall on this, and looking for help

I've been trying to import a employee roster from my HR section with SSNs
that is in excel 2007 into access 2007 to use for an employee database for my
dept. I can import it fine into access, but I want to (have to by policy) use
the SSNs in access and make it a primary key for my tables. When I try to set
the SSNs as the keyI get the "index or primary key cannot contain a null
value" error.

I'm new to access,so maybe its something simple I'm missing. Access does
import all fields as text from excel, so I'm sure that part of it.

Any suggestions?
 
J

Jerry Whittle

One or more of the rows are missing an SSN. You must have an SSN for each
record for the SSN field to be a primary key field.

Sometimes when you import from Excel, it can bring in blank rows at the end.
Instead of importing directly, link to the worksheet. Next create a query
that has Is Not Null under the SSN field. If that runs correctly, change the
query to a Make Table query. After creating the new table with the correct
data, make the SSN field the PK.

BTW: I usually caution people about using social security numbers as primary
keys. For one thing, most of the people on the planet don't have one.

Also make sure that the SSN field is the Text data type. If a number, it
will strip out any leading zeros.
 

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