Hi,
I am creating another database and need to create two comboboxes, the second combobox rowsource needs to change depending on the selection of first combobox. From googling, I believe it is called Cascading comboxes.
I have tested both of the following codes, using IF/Then, and Select Case statements. they both seem to work but not work if one is better than the other. I also want to add that if user select "Other" on the first comboxbox then the rowsource for the second combobox should be blank and any previous information should be cleared out. Any advise on what I will need to add to the code to clear out the rowsource?
If/Then Statement
Private Sub QueryType_AfterUpdate()
If Me.QueryType.Value = "USD Box" Then
Acct.RowSource = "Qry_USDLB"
ElseIf Me.QueryType.Value = "RCD" Then
Acct.RowSource = "Qry_RCD"
End If
End Sub
Select CAse Statement
Select Case QueryType.Value
Case "USD box"
Acct.RowSource = "Qry_USDLB"
Case "RCD"
Acct.RowSource = "Qry_RCD"
End Select