PDA

View Full Version : Solved: Comparing Two strings issue



ganesh3084
06-16-2011, 03:07 AM
Hi all

I have a doubt in Access VBA

I need to compare two strings with case sensitive. I have used the following code
<Code>
Dim str1 as string,str2 as string
str1="ABC"
str2="abc"
StrComp(str1, str2, vbTextCompare)
</Code>
The above code return true even though the two strings are in-equilant in terms of case sensitve. I need to compare two strings with case sensitive.
Please Suggest

hansup
06-16-2011, 04:42 PM
vbTextCompare tells StrComp to evaluate the strings without regard to case.

For your purpose, use vbBinaryCompare instead of vbTextCompare.