Hi, Im trying to make a simple programe that will make my life easier. But its more complex than i thought
i have 6 tables, 1 master and 5 sub. All the 5 tables are of different column and types.
Master Table
ID Names
1 Branch
2 Committee
3 Translation
4 Distribution
5 Audio Visual
Branch Table
ID Names Notes
1 State 1 Notes 1
2 State 2 Notes 2
3 State 3 Notes 3
Branch Officials (Branch and Branch Officials are in relation)
ID brID President Asst.President Secretary Treasurer etc
Committee Table
Translation Table
Distribution table
Audio Visual table
What i want to do is make a combo box, and populate it with the master table data. When the combobox is selected i want the next combo to display data from its respective tables. I don't know how to do this. I can populate the master data, but i want to know how to select (or open a new tables) from the value selected in the first combobox say cmbMaster. Please help
my code to open the populate the first combobox is
cmbMaster.Items.Clear()
Try
Using cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "/database.accdb;")
cn.Open()
Dim command As New OleDbCommand("SELECT * FROM master", cn)
Dim da As New OleDbDataAdapter
Dim dt As New DataTable
da.SelectCommand = command
da.Fill(dt)
cmbAux.DataSource = dt
cmbAux.DisplayMember = "Names"
cmbAux.ValueMember = "ID"
cn.Close()
End Using
Catch ex As Exception
MsgBox("Error: " + ex.Message)
End Try
Please help...