Multiple Keys

C

Chinny03

I am creating a database where my primary key is a panel number. From there
it breaks down into cells. So it is possible for a panel number to be listed
more than once. For example:

Panel number: 111111
cell: 1

Panel number: 111111
cell: 2

How could I set up a table/form so that it is possible to have the same
panel number? Thanks.
 
K

KARL DEWEY

You can not have multiple keys but you can have a nulti-field key.
Open the table in design view. Click on menu VIEW - Indexes. Add your field
in the grid and give the index a name. Then set it as primary in the window
below.
Then you can have ---
Panel number cell
111111 1
111111 2
111111 3
222222 1
222222 2
 
J

John W. Vinson

I am creating a database where my primary key is a panel number. From there
it breaks down into cells. So it is possible for a panel number to be listed
more than once. For example:

Panel number: 111111
cell: 1

Panel number: 111111
cell: 2

How could I set up a table/form so that it is possible to have the same
panel number? Thanks.

Your primary key *CANNOT* be the panel number, for this very reason: it's not
unique!

Instead, select both the panel number field and the cell field in table design
view, and click the Key icon. You'll then have a two-field primary key; either
the panel number or the cell can repeat, but the combination must be unique.

John W. Vinson [MVP]
 
K

knowshowrosegrows

I get the concept of a two key Primary key making a unique identifier. Love
that. When I test my database though and put in a record with identical
primary key fields, the database throws an errors and freezes up. Putting in
records more than once is just the kind of thing that will happen with this
database so, can you tell me the elegant way to have the user notified of the
error and not freeze up so they can change their entry?
 

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