Populate a combobox...

DT

Registered User.
Local time
Today, 08:38
Joined
Oct 23, 2000
Messages
83
I want to populate an unbound combobox depending on text in a text box.

subform:
1 combobox
cboNumber

4 queries:
qryOne
qryTwo
qryThree
qryFour

1 Text box that could have the text "One", "Two", "Three" or "Four". This info is set on the main form. If the text box says "One", how can I populate the cboNumber with qryOne or if it says "Two, I want the cboNumber to populate using qryTwo?

Is this possible?

DT
 
DT,

Code:
Select Case Me.TextBox
   Case "One"
      Me.Combo.RowSource = "qryOne"
   Case "Two"
      Me.Combo.RowSource = "qryTwo"
   Case "Three"
      Me.Combo.RowSource = "qryThree"
   Case "Four"
      Me.Combo.RowSource = "qryFour"
   End Select
Me.Combo.Requery

Wayne
 
Or slightly more succinctly:

Code:
Me.Combo.RowSource = "qry" & Me.TextBox
Me.Combo.Requery
 

Users who are viewing this thread

Back
Top Bottom