Access 2007 List box with multiple columns where each column has its own SQL query

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
With Me
.cboElibility = rst!cboElibility
.cboRebulidingLives = rst!cboRebulidingLives
  End With
End If

If IsNull(Me.txtsearch) = True Then
    MsgBox "Please entered a client ID", vbOKOnly
Exit Sub
' 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
End If
End If

    Set rst = Nothing
    Set db = Nothing
End Sub

Open in new window

Who is Participating?
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Your option might be to create a temporary table,populated adjacent columns with the desired results, then use that table as the Row Source for the List Box.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"Was wondering if a list box column can have its own separate query? "
Not really. A single query (possibly multiple tables) can be the Row Source for a List box)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.