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
   rst.MoveFirst
   Do While Not rst.EOF
With Me
.cboElibility = rst!cboElibility
.cboRebulidingLives = rst!cboRebulidingLives
  End With
  rst.MoveNext
Loop
   rst.Close
   Me.txtsearch.SetFocus
End If

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

jbakestullAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"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)

mx
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
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.

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.