spiffikins: (Default)
spiffikins ([personal profile] spiffikins) wrote in [personal profile] stoutfellow 2008-11-01 09:09 pm (UTC)

I don't know Access but this is the normalized table structure you would use.

Table: PARENT_AREA
Columns: Area_Id, Name
Contents:
1,Europe
2,Asia
3,North America

Table: COUNTRY
Columns: Country_Id, Name
Contents:
1,Ireland
2,Great Britain
3,China
4,Canada
5,US

Table: Area_Country
Columns: Area_id, Country_id
Contents:
1,1
1,2
2,3
3,4
3,5

On the form, when you select "Asia" from the Parent list, run the query
select Name from country, area_country
where country.country_id = area_country.country_id
and area_country.area_id = 2;

will bring back "China" in this example

pass in the area_id that you select.


*************

Given that you have a limited number of combinations, you could simplify it by building a single table

Table: LOCATION
Columns: Area, Country
Contents:
Europe, Ireland
Europe, Great Britain
Europe, France
Asia, China
North America, USA
North America, Canada

Same concept though - when you pick "Europe" from the parent list, you run a query:

select country from location where area = 'Europe';

and it will bring back Ireland, Great Britain, France



Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting