Chuck0185
Chuck0185

Reputation: 531

Using the Like Operator Along with Wildcard in MS Access VBA

I am trying to duplicate this SQL Query in MS Access VBA. I keep running into syntax errors. I am not sure where to use single quotes or double quotes or what have you. I'm driving myself up a wall. Could someone please duplicate this SQL code for me in VBA. I am using the docmd.RunSQL(string) command. Thank you!

Delete [Carrier File Report].[Project Tasks Name] FROM [Carrier File Report] WHERE ((([Carrier File Report].[Project Tasks Name]) Like "'" * Test * "'"));

Upvotes: 1

Views: 3930

Answers (2)

SunKnight0
SunKnight0

Reputation: 3351

If you are really looking for anything matching Test then

"...    Like '*Test*'"

If Test is a string variable you are trying to use then

 "...   Like '*" & Test & "*'"

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1271151

Is this what you intend?

WHERE [Carrier File Report].[Project Tasks Name] Like "*Test*"

Upvotes: 1

Related Questions