Delete anything with # symbol in field

S

Supe

I have a table where I want to delete and items that has ## in the Brand
name. Example would be ##VISTA. If is set up a Delete query with Like
"*##*" in the criteria field, it deletes anything with a number in
the Brand name, not anything with ## in the name. Assume Access see the # as
any number. Is there way for it to look at # as a text and not as any
number?
 
J

James A. Fortune

Supe said:
I have a table where I want to delete and items that has ## in the Brand
name. Example would be ##VISTA. If is set up a Delete query with Like
"*##*" in the criteria field, it deletes anything with a number in
the Brand name, not anything with ## in the name. Assume Access see the # as
any number. Is there way for it to look at # as a text and not as any
number?

LIKE "*[#][#]*"

James A. Fortune
[email protected]
 
S

Supe

Great. Thanks!

James A. Fortune said:
Supe said:
I have a table where I want to delete and items that has ## in the Brand
name. Example would be ##VISTA. If is set up a Delete query with Like
"*##*" in the criteria field, it deletes anything with a number in
the Brand name, not anything with ## in the name. Assume Access see the # as
any number. Is there way for it to look at # as a text and not as any
number?

LIKE "*[#][#]*"

James A. Fortune
[email protected]
 
J

John W. Vinson

I have a table where I want to delete and items that has ## in the Brand
name. Example would be ##VISTA. If is set up a Delete query with Like
"*##*" in the criteria field, it deletes anything with a number in
the Brand name, not anything with ## in the name. Assume Access see the # as
any number. Is there way for it to look at # as a text and not as any
number?

Yes; you can override the interpretation of a wildcard character by enclosing
it in square brackets. A criterion of

LIKE "[#][#]*"

will return only records with two literal octothorpes at the beginning of the
field.

John W. Vinson [MVP]
 
Top