Building a wildcard SQL stmnt w/VBA

mbath20110

Registered User.
Local time
Today, 11:00
Joined
Jul 17, 2003
Messages
13
howdy folks,

having a syntax issue. trying to build a SQL statement in VBA that creates/allows for LIKE operators. Here's what I've got so far:

strWHERE = strWHERE & " AND ((tblCLIENT.ClientName) = " & "LIKE " & " '*'cboClient '*' " & ")"

but when I run it, I get a 3075 runtime error:

Snytax error (missing operator) in query expression '((tblCLIENT.ClientName) = LIKE '*' & cboClient & '*"

thanks ...
 
strWHERE = strWHERE & " AND ((tblCLIENT.ClientName) Like ""*" & Me.cboClient & "*"")"
 
almost

thanks for the reply ...

I think I'm almost there ...

getting a compile error and the final closing parenthesis is highlighted as the offender.
 
Re: almost

mbath20110 said:
the final closing parenthesis is highlighted as the offender.

Of a larger SQL statement or the snippet above?
 
just on your snippet .

the entire code (as I'm sure you may have guessed) is simply cobbling together a series of WHERE statements and then assembling them at the end of the procedure.

On the code I sent you, if I DON'T attempt to use a LIKE statment (just use the straight cboClient) it works fine. But when I replace yours with mine (and rem out my statement) I'm getting the compile error.

Would be happy to email you the entire module if you wouldn't mind having a look.

appreciate the help.
 
correction

meant to say, 'when I replaced mine with yours'

sorry
 
mbath20110 said:
Would be happy to email you the entire module if you wouldn't mind having a look.

I'm just finishing up for the day but I'm sure you can still post the module (use the [Code] and [/Code] tags though as it sounds like it may be lengthy, making it easier to read.
 

Users who are viewing this thread

Back
Top Bottom