test first character to see if it is lower case using vba

  • Thread starter Thread starter kozmosis
  • Start date Start date
K

kozmosis

I want to see if the first character of a text field is lower case. How can
I do this in vba-ADO?
 
In VBA, you can check whether the value of StrComp(Left(TheStringValue, 1),
LCase(Left(TheStringValue, 1)), vbBinaryCompare) is 0. (if it is, then it is
lower case). Not sure what you mean by vba-ADO. I
 
Have a look at VbStrConv using the vbLowerCase constant.

If you need further help, please post back a little more detail about what
you are trying to do exactly.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
kozmosis said:
I want to see if the first character of a text field is lower case. How
can
I do this in vba-ADO?


Lower-case letters in the ASCII character set have values from 97 to 122,
while upper-case letters have ASCII values from 65 to 90. So you can use
the Asc() function to check the value of the string. Something like this:

Dim strValue As String

strValue = ...

Select Case Asc(strValue)
Case 97 To 122
' This is a lower-case letter.
Case 65 To 90
' This is an upper-case letter.
Case Else
' This is not a letter.
End Select
 
I want to see if the first character of a text field is lower case. How can
I do this in vba-ADO?

StrComp(Left([fieldname], 1), LCase(Left([fieldname]), 1), vbBinaryCompare)

will be 0 if the character is lowercase, nonzero otherwise.
 
Back
Top