Search a text string for single char

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a simple table set up upon which I am designing multiple reports. I
have a column in the table called PrintCode which can contain any
combination of letters E, C or O. I want to run a query to select different
datasets for different reports. Simple enough in theory.

SQL looks like this :

SELECT [PRICE LIST].Group, [PRICE LIST].Description, [PRICE LIST].[Normal
Rate], [PRICE LIST].Unit
FROM [PRICE LIST]
WHERE (([PRICE LIST]![PrintCode]Like "O"))
ORDER BY [PRICE LIST].Group, [PRICE LIST].Description, [PRICE LIST].[Normal
Rate];

The "Like" function is only returning those rows that contain only the
letter "O" where I thought it would return all rows that contained the
letter "O" in any position. I also tried to invert the function (WHERE "O"
like [PRICE LIST]![PrintCode])
to no avail.

help
 
OK.

%O% returned no rows

*O* returned surprisingly enough the correct number of rows (24 out of a
possible 146) .... but the wrong ones, with no discernable pattern that I
can determine.
 
*O* returned surprisingly enough the correct number of rows (24 out of a
possible 146) .... but the wrong ones, with no discernable pattern that I
can determine.

WHERE fieldname LIKE "*O*"
should give you exactly what you're after.
look again.
 
After saving changes, closing and re-openeing I re-ran the query using *O*
and all is well.

Thanks for your responses.
Steve
 
try Like "*O*" but expect it to run REAL S L O W
as jet won't be able to apply any indexes & will have to go through
every single record.

Regards Greg Kraushaar
Wentworth Falls Australia
(Do not email - the reply address is a Spam spoofer)
(If you really must, remove all UCase and numbers)
 
Back
Top