Closed Thread
Results 1 to 2 of 2

Populating listbox on the basis of Combo box selection.

  1. #1
    abhay_547
    Guest

    Populating listbox on the basis of Combo box selection.

    Hi All,

    I have the below code which works fine with Combo box. Now when try to replicate it for listbox it doesn't work properly.
    Background : I have sql table called "Region_Mapping" with two columns one is country and another is region and as far as data in both columns is concerned is basically Region and country. For e.g. In country column i have country names like USA, Brazil, Mexico and Argentina and against same country names I have region as America in Region column.

    What I want : I want to sql table data in my excel userform combobox and listbox .i.e In combo box I want to populate region names (which is already done and works fine) and in list box I want to populate country names on the basis of region selection. for e.g. If I select region as America in my Combo box then my listbox should get populated with only countries of America region .i.e USA, Brazil, Mexico and Argentina.

    Code which I have so Far :
    I have pasted the below code in Module 1 :

    Please Login or Register  to view this content.
    I have pasted the below code in userform background :

    Please Login or Register  to view this content.
    Issue : Now the issue is I have observed that it's not populating countries of those regions which have multiple countries mapped under it / mentioned against it in sql table for e.g. America has Mexico, Brazil, Argentina and USA mentioned against it in sql table but it populates the country name only for regions like Germany, UK & Japan as this regions have only one country mentioned against them in sql table.

    Now this code should work for those regions which have multiple countries mapped against them in sql table.

    Please help.

    Thanks for your help in advance.

  2. #2
    abhay_547
    Guest

    Re: Populating listbox on the basis of Combo box selection.

    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.

    Please Login or Register  to view this content.
    Any how. Thanks a lot for your help.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1