FAQ?" Two field uniqueness

K

Keith Rodgers

Access 2000

This is an inventory database question so it's probably a
FAQ.

I have a table with Make & Model fields. I want to be able
to ensure that for a particular Make there are no
duplicate Models but to allow for different Makes to have
identical Models. IOW you can't have two "Ford LeMans" but
you could have a "Ford LeMans" and a "BMW LeMans".

How do you go about it? Is that what the "Validation Rule"
is for? (For other reason I don't want to parent:child the
data).

TIA
 
J

John Vinson

I have a table with Make & Model fields. I want to be able
to ensure that for a particular Make there are no
duplicate Models but to allow for different Makes to have
identical Models. IOW you can't have two "Ford LeMans" but
you could have a "Ford LeMans" and a "BMW LeMans".

How do you go about it?

Two ways. If these two fields constitute a joint two-field Primary Key
(you can use up to ten fields), ctrl-click the two fields and click
the Key icon. Or, click the Indexes icon on the toolbar (looks like
lightning hitting a datasheet, next to the key icon); put a name for
the index in the first column and the first field in the second column
next to it, and the other field in the second column on the next row.
Specify that the index is unique.
 
K

Keith Rodgers

Two ways. If these two fields constitute a joint two-field Primary Key
(you can use up to ten fields), ctrl-click the two fields and click
the Key icon. Or, click the Indexes icon on the toolbar (looks like
lightning hitting a datasheet, next to the key icon); put a name for
the index in the first column and the first field in the second column
next to it, and the other field in the second column on the next row.
Specify that the index is unique.

Many thanks, the two field index does the trick.

The database I'm working on has a Web interface. As I know next to
nothing about HTML and Javascript I now have to find out how a bad entry
gets reported back to the interface. (Or maybe I'll just leave that
problem to the web site developers who put together such a poorly
designed db structure). :)

Cheers
Keith
 

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

Similar Threads


Top