Evi,
It probably is my lack of distinct descriptions that is making this
difficult. I'll answer your questions. The first table is a main
table, table 2 is a subtable, table 3 is a subsubtable, table 4 is a
subsubsubtable, and table 5 is a subsubsubsubtable. These 5 tables are
shown on 5 listboxes, 1st listbox is table 1 (main table) then on the
selection of ingredient or packaging listbox 2 populates with the
subtable for ingredients or packaging.
your example is correct about how the tables filter into the subtables
.....to filter another so that if (for example) you choose pets, your
next (table) will offer a list of dogs, cats, birds and when you
choose dogs from there you get poodle, Labrador, spaniel in a third
(table)?
table 1
auto# Class
1 Ingredients
2 Packaging
Currently the subtable (table 2) has both ingredients and packaging
items together, it would look like this
autonum Category Class
1 Commodities Ingredients
2 Crops Ingredients
3 Dairy Ingredients
4 Label Packaging
5 Resin Packaging
6 Corrugated Packaging
...
17
table 3 or subsubtable would look like, this table has all category
items together, ultimately both ingredient and packaging.
GroupItems Category
1 Oil Commodities
2 Flour Commodities
3 Fruit Crops
4 Nuts Crops
5 Milk Dairy
6 Resin LDPE Resin
7 Promo Label
...
40
table 4 and 5 would just filter in the same way 2 and 3 does, just a
more specific item. Make sense thus far.
The main form has an ingredientsubform, which has a combo box thats it
(to keep it simple). Table 5 has a lot of records in it since it's the
lowest filter you can go to, so every item in table 4 has multiple
items which go into table 5. table 5 also has like every other table
both ingredients and packaging, if you're not following in terms on
table items:
table 1 has 2 items
table 2 has 17 items
table 3 has 40 items
table 4 has 66 items
table 5 has 112 items
Please review table lists above, does this make sense so far? Let's
just worry about the ingredientsubform for now, I know I mentioned I
had 2 sub forms the other being for packaging. in table 5 there are
112 ingredients and packaging components, how do I get just the
ingredient components into the combo box in the ingredient sub form? I
know how to load the table/query into the combo box, but I don't know
how to separate the data whereas only ingredients goes into that combo
box? Do I put a numbering system in a new column in the tables where
if it's ingredients I put "1" and packaging I put "2" so in a new
query I can just bring in the "1" or ingredients? I know this works,
but the next tricky part is that in table 4 there are some items that
have hit the lowest breakdown they can go, if I only pull table 5 the
ones in table 4 won't get selected. This is why I did a union query
between table 4 and 5. I want it where if the item in 5 is pulled not
to pull the like item in table 4 because essentially that would be a
duplicate, make sense? But I want it to pull the item in table 4 if
it's not in table 5. With this, this doesn't separate ingredients and
packaging, do I make a query like how I mentioned earlier above for
each ingredients and packaging and do a union query off of those
tables like the SQL below? Then I can put this query into the combo
box.
SELECT [itemclass].item
FROM [itemclass]
WHERE id NOT IN (SELECT DISTINCT Group FROM itemsubclass)
UNION
SELECT [itemsubclass].item
FROM [itemsubclass ];
Thanks for helping me, I hope this explains it better.
Ryan
Argh! I must be really thick, Ryan but I still don't get it.
Your list of Ingredients means nothing to me as does your list of packaging
labels.
I can't even tell if your table structure is logical from your description.
I just don't know enough about your business. But perhaps we can communicate
in some common language
You say you have both packaging and ingredient items in the same table? Do
you mean that they are both in the same field and you have another field
which tells you if the item is an ingredient, a packaging or something else?
if Yes.
If you want 2 combos or subforms, one showing only the packaging and one
only the ingredients, then base each one on a different query which is
filtered to show only one category of items. I've not come across a combo
which comes from a union query before. How does it know which table to feed
its data into? Or is it only used to filter something?
In your description of your tables are you saying that you have a Major
Category, Sub Category, SubSubCategory structure?
What do you mean by 'both are mirrored in the same way'?
Do you mean that you want 1 combo to filter another so that if (for example)
you choose pets, your next combo will offer a list of dogs, cats, birds and
when you choose dogs from there you get poodle, labrador, spaniel in a third
combo?
It might (if I can get out of duh! mode) help to give us your table
structures (like the proposed structure I gave below) indicating the primary
and foreign key fields along with data samples which make sense to the
uninitiated.
Evi