dynamic query

pb21

Registered User.
Local time
Today, 12:24
Joined
Nov 2, 2004
Messages
122
I have a query string with the following:

StrWhere = " WHERE (((TblProduct.Description)" & " Like """ * Group * """)" & "AND ((TblProduct.CurrentProduct)=False));"

However VB is putting in a space between the asterisk around group.

so if I paste this in the qry grid it fails. how do i get this to stop this behaviour?

regards
Peter
 
i would use a msgbox to display strwhere each time unitl it final looks right. Instead of using double, double quotes, you can use chr(34) (ascii symbol for double quote - but you only need it once, anywhere you use it). its much easier to see whats going on.

StrWhere = " WHERE (((TblProduct.Description)" & " Like """ * Group * """)" & "AND ((TblProduct.CurrentProduct)=False));"

try this

StrWhere = " WHERE [TblProduct].[Description]) Like " & chr(34) & "*Group*" & chr(34) & " AND [TblProduct].[CurrentProduct] = False; "
 
It worked a treat and what an elegant way using chr 34 thank u.


regards
 

Users who are viewing this thread

Back
Top Bottom