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

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?
 
D

Douglas J. Steele

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
 
D

Daniel Pineault

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.
 
D

Dirk Goldgar

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
 
J

John W. Vinson

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.
 

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