Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Value List Syntax 1

Status
Not open for further replies.

scotttom

IS-IT--Management
Mar 5, 2002
143
US
Hopefully a simple question......

I need to set a combo box value list based on the entry in another combo box. I have the logic of how it works but I can't get the syntax..... argh.....

me.SortFilter.RowSource = "One, Two";" tblTag.One, tbTag.Two ";"Two, One";"tblTag.Two, tblTag.One"

Of course this does not work, but how do I do it?

Thanks in advance!

Scott
 
Set ListType to Table/Query

Private Sub Combo1_AfterUpdate()
me.SortFilter.RowSource = _
"SELECT txtName,txtCity,txtID FROM tblEmployee" & _
" WHERE txtName ='" & Me.Combo1 & "'"
End Sub
 
Right that would be one way, but not what I'm looking for. I'm looking for the syntax that will help me create a sort order in a sql query by using a two column combobox. Column zero is what the user sees and column one is the text that will be used to construct the sql statement.

Thanks for your help though.

Scott
 
Do you mean (?):

[tt]Me.sortfilter.RowSource = "One, Two;" & tblTag.One & "," & tbTag.Two _
& ";Two, One;" & tblTag.Two & "," & tblTag.One[/tt]

If not, what is tblTag and what are One and Two that belong to it?
 
Sorry if this is unclear....

If a user selects "One, Two" in the combo I have code that grabs the second column "tblTag.One, tblTag.two" and appends it to a sql statement as the sorting.

What I am struggling with is that when you look at it ROwSource in the properties tab it looks like this

"One, Two";" tblTag.One, tbTag.Two ";"Two, One";"tblTag.Two, tblTag.One"

But the quotes and semis don't work when defining a string in VBA. So i need the syntax to punch the above string into the property using VBA.

Clear as Mud?

Thanks for your help. I really do appreciate it. You have helped me out of many a jam.

Scott
 
So, this?

[tt]Me.sortfilter.RowSource = """One, Two"";"" tblTag.One, tbTag.Two "";""Two, One"";""tblTag.Two, tblTag.One"""[/tt]
 
Remou...You ROCK!

Seriously, how can I reapy you for your help once again? First born child???????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top