Searching for ", " in a query

B

Brian Smith

This is driving me nuts.

I have a query where I want to extract records in which a given field
contains a comma followed by a space. I thought *, * would work but I keep
getting an error about invalid comma usage. I've tried putting the comma in
square brackets but that doesn't work either. What's the proper syntax to
find ", " within a text string?

Thanks.

Brian
 
J

John W. Vinson

This is driving me nuts.

I have a query where I want to extract records in which a given field
contains a comma followed by a space. I thought *, * would work but I keep
getting an error about invalid comma usage. I've tried putting the comma in
square brackets but that doesn't work either. What's the proper syntax to
find ", " within a text string?

Thanks.

Brian

Two things: you need the LIKE operator for wildcards such as * to be
interpreted as wildcards; and you need to delimit any criteria used in a TEXT
field search (wildcards or not) with quotemarks, either ' or ". Try a
criterion of

LIKE "*, *"


John W. Vinson [MVP]
 
B

Brian Smith

John W. Vinson said:
Two things: you need the LIKE operator for wildcards such as * to be
interpreted as wildcards; and you need to delimit any criteria used in a
TEXT
field search (wildcards or not) with quotemarks, either ' or ". Try a
criterion of

LIKE "*, *"


John W. Vinson [MVP]

Thanks. Trust me, I looked through the online help and nowhere do they seem
to discuss this situation. By the way, why is it if you are using the query
grid it will put in Like and the quotation marks for you if you enter say
*str* but not in the case I mentioned? What is so special about the comma
considering it's not a wildcard character?

Brian
 
J

John W. Vinson

Thanks. Trust me, I looked through the online help and nowhere do they seem
to discuss this situation. By the way, why is it if you are using the query
grid it will put in Like and the quotation marks for you if you enter say
*str* but not in the case I mentioned? What is so special about the comma
considering it's not a wildcard character?

I have no idea! I'm so used to automatically typing in the quotemarks (and
LIKE if need be) that I've never noticed this "helpfulness".

I presume that the comma is seen as a delimiter separating two "somethings" so
it overrides the automatic editing.

John W. Vinson [MVP]
 
Top