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.

I have the below code so far.

I have below mentioned code in my userform .i.e named as frmdata.


Please Login or Register  to view this content.
Note : While establishing connection to sql server database (as I am doing in the above code) I want to mention User ID and password in my code.

And I have following code in Module1


Please Login or Register  to view this content.
Now I am facing following error while trying to launch my userform.

Please Login or Register  to view this content.
Please help I am unable to figure out that I am making a mistake at which point in the above code.

Thanks for your help in advance.