how do I set up a primary key as a customer name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to make the primary key in my vendors table, the vendor name. I
know this isn't how you usually set it up, but all my vendors would have
unique vendor names and I think I need it this way to set up an auto-fill of
vendor information on a form. When I select the vendor name as the primary
key, access tells me that it can't allow a null value for the primary key.
I'm not sure what that means. Any help would be great!
thanks
 
Dont use the vendor name as the primary key, instead use an autonumber field.
As for the error, that means that one of your records contains a blank
(null) vendor name. You will need to fix this before access will allow you to
assign a primary key.

HTH
Joel
 
I would like to make the primary key in my vendors table, the vendor name. I
know this isn't how you usually set it up, but all my vendors would have
unique vendor names and I think I need it this way to set up an auto-fill of
vendor information on a form. When I select the vendor name as the primary
key, access tells me that it can't allow a null value for the primary key.
I'm not sure what that means. Any help would be great!
thanks

A Primary Key should meet four criteria: it should be unique; it
cannot be NULL; it should be stable; and it should be short.

Name fields very frequently fail to meet ANY of these criteria.

If you wish to do so anyway, you can; to get past this NULL error
message, create a Query on your table with a criterion of

IS NULL

on the vendor name. It would seem that there is at least one record in
your table with nothing in that field. Fix that record (or those
records) and try again; if you get Access grumbling about "duplicate
values" you'll need to fix them too.

And when "Joe's Bar and Grill" changes its name to "Guiseppe's
Trattoria" you'll need to track down all the related tables and fix it
there... <g>

John W. Vinson[MVP]
 
Thank you both for the advice, I think I got it figured out!
-nikki
 
John Vinson said:
And when "Joe's Bar and Grill" changes its name to "Guiseppe's
Trattoria" you'll need to track down all the related tables and fix it
there... <g>

No you won't, if you check "Cascade updates" on the relationships.
 

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

Back
Top