J
Jamie Risk
I have a requirement of Access that can be illustrated with the following
(in my best attempt at DDL):
CREATE TABLE China (
Pattern_ID INTEGER NOT NULL PRIMARY,
Pattern VARCHAR(100) NOT NULL
)
CREATE TABLE Fruit (
Fruit_ID INTEGER NOT NULL PRIMARY,
Fruit VARCHAR(100) NOT NULL
)
CREATE TABLE Salad (
Salad_ID INTEGER NOT NULL PRIMARY,
Pattern_ID INTEGER NOT NULL,
Fruit_ID1 INTEGER NOT NULL,
Fruit_ID2 INTEGER NOT NULL,
Fruit_ID3 INTEGER NOT NULL
);
I'd like to create a form to fill out the Salad table. The constraints are
this; a patern must be chosen, between one and three fruit must be chosen
from the Fruit table, and if a particular fruit is chosen, the option is
removed from subsequent fruit selections.
Currently I have a Fruit record 'None'. The solution is inelegant and makes
it difficult to implement the third of the three constraints above.
From the above I'd then like to construct reports.
* all salad records organized by china patterns and what fruit are in them
* all salad records organized by fruit, and what patterns and other fruit
are with them
If I insist on having three fruits per plate, I can see how to do this. The
drawbacks are that when I eventually am asked to add a fourth plate, there
is a lot of maintenance to the database required, also, some people just
don't want more than one fruit!
Suggestions anyone?
- Jamie
p.s. Also, for the colonically adventerous, a less important goal would be
to have as many fruit options in the Salad form/table as fruit listed in the
Fruit table. This would be a dynamic requirement of the Salad form and
table. I can see this would be possible in a pure SQL environment, but I'd
like to know if it's possible in Access.
(in my best attempt at DDL):
CREATE TABLE China (
Pattern_ID INTEGER NOT NULL PRIMARY,
Pattern VARCHAR(100) NOT NULL
)
CREATE TABLE Fruit (
Fruit_ID INTEGER NOT NULL PRIMARY,
Fruit VARCHAR(100) NOT NULL
)
CREATE TABLE Salad (
Salad_ID INTEGER NOT NULL PRIMARY,
Pattern_ID INTEGER NOT NULL,
Fruit_ID1 INTEGER NOT NULL,
Fruit_ID2 INTEGER NOT NULL,
Fruit_ID3 INTEGER NOT NULL
);
I'd like to create a form to fill out the Salad table. The constraints are
this; a patern must be chosen, between one and three fruit must be chosen
from the Fruit table, and if a particular fruit is chosen, the option is
removed from subsequent fruit selections.
Currently I have a Fruit record 'None'. The solution is inelegant and makes
it difficult to implement the third of the three constraints above.
From the above I'd then like to construct reports.
* all salad records organized by china patterns and what fruit are in them
* all salad records organized by fruit, and what patterns and other fruit
are with them
If I insist on having three fruits per plate, I can see how to do this. The
drawbacks are that when I eventually am asked to add a fourth plate, there
is a lot of maintenance to the database required, also, some people just
don't want more than one fruit!
Suggestions anyone?
- Jamie
p.s. Also, for the colonically adventerous, a less important goal would be
to have as many fruit options in the Salad form/table as fruit listed in the
Fruit table. This would be a dynamic requirement of the Salad form and
table. I can see this would be possible in a pure SQL environment, but I'd
like to know if it's possible in Access.