Same Primary Key in Different Tables

S

SactoGal

I'm new to Access and using Access 2003. I'm setting up my tables and have 2
questions. 1) I have a table for customer names. I set up Customer ID with
Autonumber as the primary key. I want to use Customer ID in another table
again as the primary key. Do I set it with Autonumber again or set it to
Numerial? 2) If I use an input form to create a new customer, how does
Customer ID actually get created? Thanks in advance for your help.
 
A

Allen Browne

To use the same CustomerID as primary key in another table, use a field of
type Number.

When you create a relation between your 2 tables (in the Relationships
window), this will give you a one-to-one relation, since the field is unique
in both tables.

You do not automatically get a record inserted into the related table when
you add a new customer to your main table. You can program it in the
AfterInsert event procedure of the form where you enter customers if you
have a reason to do so.

Before you get that far, it might be worth considering whether you are
actually creating a design that is correctly normalized. There are some
cases where what you are doing could be right, but if you are only doing
this because Access won't let you have more than 255 fields in your Customer
table, the design is not right.
 
M

msnews.microsoft.com

Lazy. moronic, rude and inconsiderate top-posting fixed.
it might be worth considering whether you are actually creating a design
that is correctly normalized.

LMAO
 

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