locked
Case Sensitivity Issue RRS feed

  • Question

  •  

    I have code that pulls information from an access 2003 database and compares it with an input from a userform in excel 2003. However, when comparing names, the input from the userform needs to be EXACTLY as it is in the access database, it is very case sensitive, is there anyway that i can get rid of the sensitivity? here is my code:



    Dim DBFullName As String

    Dim TableName As Variant

    Dim cn As ADODB.Connection

    Dim continue As Boolean

    Dim blah As VbMsgBoxResult

    Dim RSName As Recordset

    Dim RSProcedureNum As Recordset

    Dim RSValidate As Recordset

    Dim Missing, Missing1, Missing2 As Boolean

    Dim cmd As ADODB.Command



    DBFullName = "file://server/documentation/Training Database\Training Database.mdb"

    TableName = Array("Employee", "Training", "[Training Record]")



    Dim EmpID As Integer

    Dim ProcID As Integer

    Dim version As Integer



    ' Create Our Database Connection

    Set cn = New ADODB.Connection

    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DBFullName & ";"



    ' Initialize the Recordsets

    Set RSName = New ADODB.Recordset

    Set RSProcedureNum = New ADODB.Recordset

    Set RSValidate = New ADODB.Recordset

    Set cmd = New ADODB.Command



    RSName.Open "SELECT * FROM " & TableName(0), cn, adOpenKeyset, adLockPessimistic, adCmdText

    Do Until RSName.EOF

    If name = RSName.Fields.Item("Full Name") Then

    EmpID = RSName.Fields.Item("EmployeeID")

    RSName.Close

    Exit Do

    Else

    RSName.MoveNext

    End If

    Loop

    Thursday, January 8, 2009 3:48 PM

Answers

  • i just used 'option compare text' at the begining of my code, and it seemed to work.  thanks!
    • Marked as answer by kdinardi Wednesday, June 10, 2009 4:28 PM
    Wednesday, June 10, 2009 4:28 PM

All replies

  • Hi,

    You could use the STRCOMP function or convert both to either upper of lowercase before doing comparison.

    Cheers
    Thursday, January 8, 2009 4:06 PM
  • i just used 'option compare text' at the begining of my code, and it seemed to work.  thanks!
    • Marked as answer by kdinardi Wednesday, June 10, 2009 4:28 PM
    Wednesday, June 10, 2009 4:28 PM