How to link tables by autonumber key?

D

David

I need to link 2 tables by an autonumber key, how is this
done.
I was told to specify the column as 'long integer' but how
do I specify which table and autonumber column to link to?
 
J

Jeff Boyce

David

Autonumber fields are typically used as primary keys. If you are trying to
link two tables, you would NOT want to relate them by their Autonumber
fields, as each table could (and will) independently create Autonumbers as
row identifiers.

Before you relate/link to tables, they really ought to be related, somehow.
What is the relationship between your tables? Do you have, say, one order
and multiple ItemOrderDetail rows ("I'll take 3 of those and six of these
and a dozen of those...")?

If one of your tables is the "child" (the many) relationship to the other,
you can still use an Autonumber as the primary key, but you also need a
foreign key field that holds the value of the "parent" table row to which it
is related. This foreign key needs to be typed as "Long Int" in the child
table.

Now you can use the Relationships window to link the Primary Key of the
parent table to the (related) foreign key of the child table.

Good luck!

Jeff Boyce
<Access MVP>
 

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