Testing if a string is Ucase or not

message from Scotty on 24 May 2004
Hi,
Can anybody tell me how to test if a string is Uppercase (Ucase) or
not ?

The functions Ucase and LCase only seem to convert a supplied string
and not actually test them.

Hoping someone knows !...

Scotty
 
Dirk Goldgar replied to Scotty on 24 May 2004
"Scotty" <scotty@lycos.com> wrote in message
news:e508af27.0405240945.a511607@posting.google.com

If StrComp(MyString, UCase(MyString), vbBinaryCompare) = 0 Then
' MyString is upper case
Else
' MyString is mixed or lower case
End If
 
Rick Brandt replied to Scotty on 24 May 2004
If InStr(1, StringVar, UCase(StringVar), vbBinaryCompare) > 0 Then...

The above tests to see if the unaltered string is found within the same
string forced to all caps and the vbBinaryCompare does the test in a
case-sensitive manner. If InStr returns a value other than zero then the
original string was in all caps, otherwise it was not.
 

Archived message: Testing if a string is Ucase or not (MS Access Forms)