I'm not that experience working/understanding list boxes. Was wondering if a list box column can have its own separate query?
The syntax code below looks up "Eligibility" and "Subsidy" values based off client id. The two values "Eligibility" and "Subsidy" are matched up against another table to populate "provider Id" that matched. The reason why I would like to use separate queries for each column is to add additional information like occupancy, availability etc. All this information is located on different tables.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim tblRst As DAO.Recordset
Dim strSql As String
Dim vcatch As String
Dim db1 As DAO.Database
Dim rst1 As DAO.Recordset
Dim strSql2 As String
strSql = "Select * from tblFamilyCharac Where [strClientId] = '" & Me.txtsearch & "'"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSql, dbOpenDynaset)
If Not (rst.BOF And rst.EOF) Then
Do While Not rst.EOF
.cboElibility = rst!cboElibility
.cboRebulidingLives = rst!cboRebulidingLives
If IsNull(Me.txtsearch) = True Then
MsgBox "Please entered a client ID", vbOKOnly
' Loading list box choices based off client elibility and rebuilding lives values
strSql2 = "SELECT strProviderName As Provider FROM tblEligibilityCharacteristics WHERE intRebuildingLives='" & Me.cboElibility & "' AND strSubsidy='" & Me.cboRebulidingLives & "'"
vcatch = strSql2
Me.txtlist.RowSource = vcatch
Set db1 = CurrentDb
Set rst1 = db.OpenRecordset(strSql2, dbOpenDynaset)
If Not (rst1.EOF And rst1.BOF) Then
'display your records
Else ' if no records found
MsgBox "No records found!", vbOKOnly
Set rst = Nothing
Set db = Nothing