Differences between lower case and upper case

  • Thread starter Thread starter Maracay
  • Start date Start date
M

Maracay

Hi guys,

I am analyzing a code character by Character, in some point I need to work
just with the upper case letters, but when I ask, lets say If w-letter = “Iâ€
then, I also get lower case “iâ€, how can I solve this situation.

Thanks
 
Hi guys,

I am analyzing a code character by Character, in some point I need to work
just with the upper case letters, but when I ask, lets say If w-letter = “I”
then, I also get lower case “i”, how can I solve this situation.

Thanks

Take a look at the VBA help for the StrComp() function. Another approach is to
use the Asc() function to get the ASCII numeric value for the character:
?asc("i")
105
?asc("I")
73

If you're doing the comparisons in VBA code, you may want to try specifying

Option Compare Binary

instead of the default Option Compare Database at the very top of your module.
See the VBA help for "Option Compare".
 
Maracay,

Here are two of many options you can look into:

1 - The StrComp function using the vbBinaryCompare option will give you a
case sensitive comparison.

2 - You could use the Asc function to convert the character to its ASCII
value. The upper case characters have values of 65 (A) to 90 (Z) and the
lower case characters have values of 97 (a) to 122 (z).

Good luck.

Sco

M.L. "Sco" Scofield, MCSD, MCP, MSS, A+, Access MVP 2001 - 2005
Denver Area Access Users Group Past President 2006/2007 www.DAAUG.org
MS Colorado Events Administrator www.MSColoradoEvents.com
This email made with 100% recycled electrons!
Miscellaneous Access "stuff" at www.ScoBiz.com
 
Hi,

If you want to make John and Sco's solutions more generic and to
include Unicode characters, you can the AscW() function instead of the Asc()
function. Or you can use the UCase() function with the StrComp() function:

StrComp(strSomeChar, UCase(strSomeChar), vbBinaryCompare)

A return value of 0 indicates the letter in strSomeChar is an uppercase
letter.

Clifford Bass
 
Hi,

Little bit more: You will also get 0 if the item is not a letter. To
check to see if something is a letter that can have upper and lower case and
if the letter is in the upper case you might do something like this:

If StrComp(LCase(strSomeChar), UCase(strSomeChar), vbBinaryCompare) <> 0 And
StrComp(strSomeChar, UCase(strSomeChar), vbBinaryCompare) = 0 Then
.....
End If

Clifford Bass
 
Back
Top