I have a form where I have to say two dropdown lists.
Firts dropdown list is populated based on query from a table in access database.
I have another dropdown list .I woud like in that second dropdown to show only values that are relevant to the selection in the first dropdown.
In my case first dropdown CedantID,
Second dropdown CompnayType.
So when a CedantID is selected I want in the second drop down to show the available company types for the currently selected Cedant ID.
Here is the Code I have:
Private Sub execute(ByVal CedantID) 'handles getting the currently selected data in controls Dim connSelCompType As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB\DataStatusRecord1.mdb") Dim strSQL1 As String = "select (CedantID,CompanyType) from (Recording) GROUP BY (CedantID,CompanyType) having CedantID=@CedantID ORDER BY (CompanyType)" Dim cmd1 As Data.OleDb.OleDbCommand connSelCompType.Open() cmd1 = New Data.OleDb.OleDbCommand(strSQL1, connSelCompType) Dim da1 As New System.Data.OleDb.OleDbDataAdapter(cmd1) Dim dsCompanyType As New Data.DataSet da1.Fill(dsCompanyType) cmd1.ExecuteNonQuery() connSelCompType.Close() End Sub
I have the @CedantID specified to be the currently SelectedValue in the CedantId in the dsCompanyType select query property.
It doesn`t seem to work.
Am I missing something.
Do I have to have some more code in the index change event to make it happen.
Any help will be appreciated.