I'll assume you don't actually want to put two separate fields together into
one (hint: you don't want to put two separate fields together into one!),
and that you are asking how to tell Access that the primary key spans the
two columns...
Open the table in design mode. Make sure to take off any existing primary
key. Highlight the two fields (rows) you want to use as a (multi-column)
primary key. Click on the <Primary Key> toolbar button.
Why? It's never a good idea to store redundant data. Access allows you to
have up to 10 separate fields in a separate index. Have your primary key be
the two fields, rather than concatenating them.
Also there is a strong debate whether to use data which has meaning as the
primary key. Many people use natural primary keys like Names for the primary
key. As the primary key as meaning, it's easier to follow.
Others, myself included, used artificial primary keys like autonumbers and
use something like your two fields as a unique constraint to prevent
duplicates.
The big problem happens when a natural primary key has a change in meaning.
Ann Smith gets married and becomes Ann Jones and you already have an Ann
Jones. Fortunately Access has cascade update if you have referential
integrity enabled to help with this problem.
I like to glue the tables together with autonumbers. They have no meaning
therefore the meaning can't change.
Why? It's never a good idea to store redundant data. Access allows you to
have up to 10 separate fields in a separate index. Have your primary key be
the two fields, rather than concatenating them.
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.