Thanks in advance for even reading my cry for help,
I am trying to change the recordsource of an ADO data controller,
by choosing an option from a combobox.
this is the code I'm struggling to get to work:
Private Sub cmbContact_dropdown()
Dim cn As New ADODB.Connection
Dim state As Integer
Select Case state
Case cmbContact.ListIndex = 0
Set Recordset = Adodc1.RecordSource("InternetDataQuerytotaal")
Case cmbContact.ListIndex = 1
Set Recordset = Adodc1.RecordSource("MagazinesDataQuerytotaal")
Case cmbContact.ListIndex = 2
Set Recordset = Adodc1.RecordSource("NewspapersDataQuerytotaal")
Case cmbContact.ListIndex = 3
Adodc1.RecordSource = "PersbureauDataQuerytotaal"
Case cmbContact.ListIndex = 4
Adodc1.RecordSource = "PlayermanagersQuerytotaal"
Case cmbContact.ListIndex = 5
Adodc1.RecordSource = "PlayersDataQuerytotaal"
Case cmbContact.ListIndex = 6
Adodc1.RecordSource = "ReportersDataQuerytotaal"
Case cmbContact.ListIndex = 7
Adodc1.RecordSource = "WebmastersDataQuerytotaal"
Case cmbContact.ListIndex = 8
Adodc1.RecordSource = "AdvertisersQuerytotaal"
End Select
End Sub
The unreadable stuff is Dutch, do not adjust your monitor...
As you can see i tried something different for the first 4 options.
Has anybody got a slightest idear how to pull this off ?
Last but not least, how do i reload the combobox after an option is chosen ?