Discussion:
How can I allow only one record per category?
(too old to reply)
Rachel Garrett
2011-08-11 18:02:46 UTC
Permalink
Greetings,

Suppose I have a database with a category for Region, and the
possibilities are North, South, East, and West. (I might want to add
regions in the future, and some tables will have more than one record
per region, so Region needs to be its own column rather than having
columns for North, South, East, and West individually.)

Now let's say that there are some tables that use Region, where I want
to allow only one record for North, one record for South, one for
East, and one for West.

What is the best way to accomplish this?

Thanks,
Rachel
XPS350
2011-08-11 19:53:37 UTC
Permalink
Put all the data in one table and make Region the primary key of that table.

Peter
http://access.xps350.com/
Access Developer
2011-08-12 18:51:33 UTC
Permalink
In the table in which you want only one record per region, index the Region
column, and, in the properties, specify "no duplicates".

As XPS350 said, if you make Region a Primary Key, it will be indexed with no
duplicates allowed, but it is not _necessary_ that Region be the Primary
Key, only with properties as I described.
--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access
Post by Rachel Garrett
Greetings,
Suppose I have a database with a category for Region, and the
possibilities are North, South, East, and West. (I might want to add
regions in the future, and some tables will have more than one record
per region, so Region needs to be its own column rather than having
columns for North, South, East, and West individually.)
Now let's say that there are some tables that use Region, where I want
to allow only one record for North, one record for South, one for
East, and one for West.
What is the best way to accomplish this?
Thanks,
Rachel
Rachel Garrett
2011-08-19 13:43:50 UTC
Permalink
Post by Access Developer
In the table in which you want only one record per region, index the Region
column, and, in the properties, specify "no duplicates".
As XPS350 said, if you make Region a Primary Key, it will be indexed with no
duplicates allowed, but it is not _necessary_ that Region be the Primary
Key, only with properties as I described.
Thanks; I'll use this.

--Rachel

Loading...