Populate a comboxbox and Listbox in a excel userform with an sql table data
abhay-547 wrote on 04/13/2010 00:02 ET :
Hi All,
I have a excel userform which has some combo boxes and list boxes and I want
to
populate this boxes with the data which I have on my sql server database
tables. Just to give an example. My first combo box is for region which
needs
to be populated from a sql table called Region_Mapping and my first list box
should be linked to the same sql table but it should populate the countries
on
the basis of the region which user will select in the combo box. For eg : In
my
sql table I have following countries which are mapped against America
1) Argentina
2) Brazil
3) Mexico
4) Canada.
Now if the user selects the region America in Combo box one then the List
box
one should get populated with the above mentioned countries with check boxes
so
that user can remove the unwanted countries while extracting data. Please
expedite.
Hi All,
Finally I got it. The issue was with the below sql statement .i.e instead of
region I had mentioned country in the same.
SELECT DISTINCT Country FROM Region_Mapping WHERE Region = '" & ComboBox1.Value
& "' "
Any how. Thanks a lot for your help.
|