Consulting

Results 1 to 2 of 2

Thread: "Solved": case sensitive FindFirst

  1. #1
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location

    Thumbs up "Solved": case sensitive FindFirst

    Thanks for the help.
    First: The suggested set rs = Me.Recordset.clone doesn't work, but plain Me.RecordSet does!
    Second, a "work around". Who wants to struggle with all variations and permutations of single and double quotes?
    I have a table (table1) containing case sensitive alphanumeric keys. A combo box (combo11) displays these keys. I chose a key from this box and want FindFirst to find the record with this key..the problem is findFirst is not case sensitive!
    A good suggestion was to use Strcomp(), which leads to very complicated (for me) quotes and double quotes..sometimes!

    The "Work round": is to add a field to the table that contains an "Automatic Number".
    Next, Have the combobox contain BOTH this field and the key to be searched for, but do not display the key!(Set its width = 0).
    Then, when a key is clicked, the automatic number is searched for. And keys such as Hello, Hello,HEllO, etc, all have UNIQUE automatic numbers! I call this number "crutch"
    A simple vba is below:
    In a Form,
    The combo box is initiated in the forms Form activate:
    [VBA]With combo11
    .RowSource = "Table1"
    .Rowsourcetype = "Table/Query"
    .ColumnCount = 2
    .ColumnWidths = "0;1"
    .value = ""
    End With

    Next, in the combo11.click sub:
    Dim tempo as Integer
    Dim rs as recordset
    Set rs = Me.Recordset ' Not .clone!
    tempo = Combo11.column(0) ' the column containing the automatic number
    AND:
    rs.FindFirst "[Crutch] = " & Tempo & ""[/VBA]
    I found that ACCESS would not handle something like [Combo11.column(0)], so I simplified by using Tempo. At least I couldn't get it to!

    Click on a key and the found record immediately becomes the record displayed in the form!

    Now what will go wrong?

  2. #2
    Knowledge Base Approver VBAX Master Oorang's Avatar
    Joined
    Jan 2007
    Posts
    1,135
    Location
    What was the solution?
    Cordially,
    Aaron



    Keep Our Board Clean!
    • Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
    • Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •