G
Guest
I know how to concatenate a SQL string and make it the RowSource of a combo
box in VBA on the fly, but how would I pass just the Where clause from VBA to
an existing query. (This is because the query is used in more places than
just this row source.)
Currently:
Dim strSelect as String
Dim strWhere as String
strSelect = "SELECT blah blah blah FROM blah blah blah"
strWhere = "WHERE blah blah blah = blah blah blah"
combo1.RowSource =strSelect & strWhere
If I put the Select clause into a query, I can just do this:
combo1.RowSource = query1
How, though, would I combine the two: use the query name for the Select
clause but pass the Where clause from VBA, since that is the only part that
needs to be dynamically altered?
box in VBA on the fly, but how would I pass just the Where clause from VBA to
an existing query. (This is because the query is used in more places than
just this row source.)
Currently:
Dim strSelect as String
Dim strWhere as String
strSelect = "SELECT blah blah blah FROM blah blah blah"
strWhere = "WHERE blah blah blah = blah blah blah"
combo1.RowSource =strSelect & strWhere
If I put the Select clause into a query, I can just do this:
combo1.RowSource = query1
How, though, would I combine the two: use the query name for the Select
clause but pass the Where clause from VBA, since that is the only part that
needs to be dynamically altered?