[AccessD] capitals in query

Stuart McLachlan stuart at lexacorp.com.pg
Tue Sep 26 07:48:12 CDT 2006


On 26 Sep 2006 at 13:59, pedro at plex.nl wrote:

> how can i search only for capitals in a query?
> i need ER not er.

You need to use strComp to do a binary comparison

As a one off:
SELECT myText FROM myTable WHERE 
StrComp("ER",Mid$([myText],InStr([myText],"ER"),2),0)=False;

Here's a general function I've just knocked up (must stick this one in my 
toolbox <g>):

Function ExactMatch(SearchStr As String, Matchstr As String) As Boolean
ExactMatch = StrComp(Matchstr, Mid$(SearchStr, _
    InStr(SearchStr, Matchstr), Len(Matchstr)), 0) = 0
End Function

Now you can make your query:

SELECT myText FROM myTable
WHERE ExactMatch([mytext],"ER")=True




-- 
Stuart





More information about the AccessD mailing list