Hello.
Sorry if posting this thread in the wrong section.
I have a form on which I have a combo (cbostudy) and a listbox (lstStudy).
I would like the list box to dynamically change the record source to different queries, depending on the selection in the combo.
I have already created two queries and in each one I have added the criteria that will return the selected records.
I have found some code and changed it but the list box does not requery and therefore I don't get any result. This is the code in the AfterUpdate event of my combobox:
If Me![cboStudy] = "Rep Payee" Then
Forms![frmMenu]!lstStudy.RowSourceType = "Query/table"
Me![lstStudy].RowSource = "qryRepPayee"
Me!lstStudy.Requery
Else
If Me![cboStudy] = "US Citizens" Then
Forms![frmMenu]!lstStudy.RowSourceType = "Query/table"
Me![lstStudy].RowSource = "qryuscit"
Me!lstStudy.Requery
End If
End If
End Sub
The combo has one column and is bound to 1.
Queries have already the criteria (ex. in query rep payee is "1")
Thank you for any help.
Sorry if posting this thread in the wrong section.
I have a form on which I have a combo (cbostudy) and a listbox (lstStudy).
I would like the list box to dynamically change the record source to different queries, depending on the selection in the combo.
I have already created two queries and in each one I have added the criteria that will return the selected records.
I have found some code and changed it but the list box does not requery and therefore I don't get any result. This is the code in the AfterUpdate event of my combobox:
If Me![cboStudy] = "Rep Payee" Then
Forms![frmMenu]!lstStudy.RowSourceType = "Query/table"
Me![lstStudy].RowSource = "qryRepPayee"
Me!lstStudy.Requery
Else
If Me![cboStudy] = "US Citizens" Then
Forms![frmMenu]!lstStudy.RowSourceType = "Query/table"
Me![lstStudy].RowSource = "qryuscit"
Me!lstStudy.Requery
End If
End If
End Sub
The combo has one column and is bound to 1.
Queries have already the criteria (ex. in query rep payee is "1")
Thank you for any help.