case sensitive match query

M

Mike

I'm trying to create a query between two tables that will
match case sensitive letters... example 55A and 55a
should not match up. Instead I'm looking for another
55A. Can anyone help?

fyi... In the find function there is a control box that
allows users to select "MATCH CASE". That would be
perfect for what I'm trying to do but for queries. :(
 
M

Michel Walsh

Hi,


You can use StrComp( ), a VBA function, to compare string


? StrComp("55A", "55a", vbBinaryCompare)
-1

Note: StrComp returns 0 if there is equality, -1 and +1 if the first
argument is before, of after, the second argument, in the ordering (sort).
You would have to use 0, rather than the constant vbBinaryCompare, in a
query.


SELECT table1.*, table2.*
FROM table1 INNER JOIN table2 ON table1.Name = table2.Name
WHERE 0= StrComp(table1.name , table2.name, 0)


Note that I still use an inner join on a string (case insensitive)
comparison, just to reduce the number of records to be further tested with
StrComp, of a slower performance (I imagine, without having tested it).


Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top