Need help on UCase

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi folks,

Could anyone tell me how to fix the following code? It
always returns true value even Me.LoginID contains lower
case letter.

Private Sub LoginID_LostFocus()

If Me.LoginID = UCase(Me.LoginID) Then
MsgBox "Match"
Else
MsgBox "Unmatch"
Me.LoginID = UCase(Me.LoginID)
End If

End Sub

Thanks in advance.

Tim.
 
Look up Option Compare Statement in the help file.

Basically, Access databases are not case sensitive.

CHRIS = chris

If you want to compare two strings, you could use:


Public Function Compare(strFirst As String, strSecond As
String, Optional blnCaseSensitive As Boolean = True) As
Boolean
Dim intLen As Integer
If blnCaseSensitive = False Then
Compare = (strFirst = strSecond)
Else
If Len(strFirst) = Len(strSecond) Then
Compare = True
For intLen = 1 To Len(strFirst)
If Asc(Mid(strFirst, intLen, 1)) <> Asc(Mid
(strSecond, intLen, 1)) Then
Compare = False
Exit For
End If
Next intLen
Else
Compare = False
End If
End If
End Function

Chris Nebinger
 
Back
Top