Simple duplication question

M

micarl

I have a table used for a subform with these fields -
Staff SelectID - this is AutoNumber Primary Key
StaffID - This is based on a query that pulls this from the Staff
Table
ContactID - This is based on the same query but pulls this value from
the Contact table
StaffIDContactID - I want this to = the StaffID & ContactID so that i
can set this to no duplicates.

I want users to be able to assign the same staff member to more than
one contact and i want each contact to be able to have more than one
staff contact.
How do i get the StaffIDContactID field to automatically populate with
these two other fields so that i can ensure that each staff member
isn't assigned to the same contact more than once?
 
A

Arvin Meyer [MVP]

It's called a compound key or compound index.

If you want to do this as a Primary Key, move the 2 fields together in the
table using drag and drop. Then select them both, an use the Primary Key
button, or select it from the menu.

For a compound index, open the index dialog, and move the fields together
under 1 index name and select Unique. You can also use this method to make a
Primary Key.

A table may have up to 32 indexes, including the ones Access builds
automatically when you create a relationship. IIRC, a single compound index
can contain up to 10 fields.
 

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