On 8 May 2006 12:28:14 -0700, "Arun" <ar***************@gmail.com>
wrote:
Hi Group,
I was trying to link a combo box with a list control and having some
trouble with that. Could anyone please help me with that. Here's the
example of the scenario.
Combo Box ;- Country_Names (Pulls values from the country table(Just
the country_name value))
(Each country will have a table by itself, For Example USA will be a
table and it will have fields like "Area", Population", "States",
"Major Cities", "Males", "Females"...etc." the fields vary from country
to country. USA will have 20 Fields where as Japan will have just 18
fields and UK will have 15 only.)
ListViewCtrl:- (This will display the fields pertaining to every
country. For Example,If I chose USA in the "Country_Name" Combo box
then fields in the USA table needs to be displayed here.
I'm kind of having trouble to link these two controls "Combo Box" and
"ListCtrlView". Could anyone please help me with this. OR is there any
other way to do this? All suggestions are highly appreciated.
Arun,
You need to spend some time familiarizing yourself with the concept of
normalization, as the design you have defined above is not.
An example might be three tables:
tblCountries
============
Country_ID
CountryName
CountryAbbrev
tblStatistics
=============
Statistic_ID
Statistic (eg., "Population")
tblCountryStatistics
=============
fk_CountryID
fk_StatisticID
StatisticValue (eg. 310,000,000)
I note that the type of fields that you are describing are sometimes
numeric (Population) and sometimes can themselves be a list (Major
Cities). Unless you meant them all to be statistics in the sense that
the value associated with Major Cities is the NUMBER of Major Cities.
Assuming you meant the former, you have quite a challenge on your
hands designing a system whereby you can tell the difference between
the two at the right time (is it a list, or a statistic? hmmmmmm)
For now, I've stopped here on the theory that the values are always
statistics. If they aren't, then you need to define the next level
before going on.
Anyway, once you have the table design established, the values for
your countries combo box come from the tblCountries table.
And the values for your list view come from the combination of what
was selected in the combo box and the tblStatistics table.
Once you have both, you can then do what you will with the values from
the tblCountryStatistics.
You can, although I wouldn't recommend it, short circuit this design
by axing the middle table and modifying the third table as follows:
tblCountryStatistics
=============
Statistics_ID
fk_CountryID
StatisticValue (eg. the population)
This will still allow you to build your list view, but it is not as
flexible for further development.
mike