Hello,
I have 2 comboboxes.
When I choose a country in cboLand I want only the states to show in cboStaat that are associated with the country from cboLand.
I tried the code below but I get all different error messages.
Perhaps you can see something in my code that I missed.
Thanks in advanceCode:Public Sub SelectLand() Dim adapter As New OleDbDataAdapter("SELECT Land_ID,Land FROM tblLAND", connection) Dim table As New DataTable adapter.Fill(table) With Me.cboLand .DataSource = table .DisplayMember = "Land" .ValueMember = "Land_ID" .SelectedIndex = 0 End With End Sub Public Sub SelectStaat() Dim adapter As New OleDbDataAdapter("SELECT Staat_ID,Staat FROM tblSTAAT WHERE Land_ID = " & Me.cboLand.SelectedItem, connection) Dim table As New DataTable adapter.Fill(table) With Me.cboStaat .DataSource = table .DisplayMember = "Staat" .ValueMember = "Staat_ID" .SelectedIndex = 0 End With End Sub




Reply With Quote