I have two ComboBox'es. The values of the second Combo depend on the first one.
If I select a value from the first Combo then a statement (Me.club_a.RowSource = "SELECT club.[club-id], club.naam, club.[league-id] FROM club WHERE club.[league-id]=" & Me.league
) in the Change event causes the RowSource of the second Combobox to display only the related values.
That way I entered some data.
When I paged back through the records I found the second Combo only displaying values if they match the then current value in the first Combo. (okay.. logical I then thought.. i'v changed the rowsource, and the corresponding value can't be found anymore, so they won't show)
So, I decided to reset the RowSource of the second Combo to the entire table again on the Current event (Me.club_a.RowSource = "SELECT club.[club-id], club.naam, club.[league-id] FROM club").
That worked. The values in the second Combo displayed fine. The value in the first Combo stayed the same.
But, adding new records didn't work the way I wanted anymore. The Current event caused that I have to explicitly select a value from the first Combo again to get the second Combo to show only the dependent records.
If I page back I want the first Combo to display the value related to the second Combo box. If I enter new records, I want the second ComboBox to have a RecordSource dependant on the value in the first ComboBox.
maybe someone can help me with a hopefully very simple solution.
thanks in advance.
If I select a value from the first Combo then a statement (Me.club_a.RowSource = "SELECT club.[club-id], club.naam, club.[league-id] FROM club WHERE club.[league-id]=" & Me.league
) in the Change event causes the RowSource of the second Combobox to display only the related values.
That way I entered some data.
When I paged back through the records I found the second Combo only displaying values if they match the then current value in the first Combo. (okay.. logical I then thought.. i'v changed the rowsource, and the corresponding value can't be found anymore, so they won't show)
So, I decided to reset the RowSource of the second Combo to the entire table again on the Current event (Me.club_a.RowSource = "SELECT club.[club-id], club.naam, club.[league-id] FROM club").
That worked. The values in the second Combo displayed fine. The value in the first Combo stayed the same.
But, adding new records didn't work the way I wanted anymore. The Current event caused that I have to explicitly select a value from the first Combo again to get the second Combo to show only the dependent records.
If I page back I want the first Combo to display the value related to the second Combo box. If I enter new records, I want the second ComboBox to have a RecordSource dependant on the value in the first ComboBox.
maybe someone can help me with a hopefully very simple solution.
thanks in advance.
Last edited: