Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autonumber as a primary key

Status
Not open for further replies.

fluidpowerchicky

Technical User
Sep 28, 2001
3
US
I am so totally stuck. Using autonumber as a primary key how do I create a relation to other tables? Do I make a field with type "Number" and an integer and just assume that the number will have to be typed?

X-)
 
I believe it says in table design that to match up with an autonumber your foreign key field has to be long integer. Having the number typed into the field would work, but there are many ways to automate that, in forms with lookups, etc. Best answer depends on what you are trying to do.
 
I would make it either the number or long int as tempclerk suggests. I would not allow the user to type it, as this gives the chance for a typo. I would have that field = your autonumber field's value. Terry M. Hoey
 
I set mine like:
Master_T ID is autonumber (Many)
Subtable_T id is long integer (Number) (One)
This will allow you to set a one to many relationship. You don't have to enter any numbers into the subtable, Access does it for you.
-Smack X-)
 
My bad. I walked off and realized I stated that backwards. The way I put would represent a Many to one, not a one to many. Srry for any confusion.
-Smack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top