Synchronized two combobox-VBForums
Results 1 to 2 of 2

Thread: Synchronized two combobox

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    673

    Question Synchronized two combobox

    Hi

    I have a table and I must to populate two combobox with data from this

    Example data from my table

    Name:  COMBO2.jpg
Views: 91
Size:  48.0 KB

    The column UF I must to populate in combo1

    The column PRODUCT I must to populate in combo2

    For this I should make a select distinct
    Name:  SELECT.jpg
Views: 69
Size:  18.3 KB

    When user click in combo 1
    Example 'SP' It should allow to display in combo 2 only the products APPLE and BANANA

    But if the user to click in combo 1 in 'MG' It should allow to display in combo 2 only the products APPLE BANANA and PINAPPLE

    But the user can first click combo 2, and choose for example PINAPPLE , then in combo 1 Only MG should appear

    How can I to Implement this ?

    Tia
    Attached Images Attached Images   

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,182

    Re: Synchronized two combobox

    Fill your first combo.

    When the selection changes in the first combo then query your data to get the proper records and fill the second combo.

    Basically you need to rebuild the second combo each time the first one changes in order to have accurate items in the second one that match up to what was selected in the first.

    For the first one you only want the unique values from field 1
    The second one you would want only value from field 2 where field1 matches the selected item in the first combo

    Or perhaps you want to do it the other way around, not sure but you can't really do it both ways at the same time
    Last edited by DataMiser; Dec 16th, 2016 at 06:24 AM.

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.