Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004

    Unanswered: Real Puzzler!!!!!

    Ok, I'm sure everybody is familiar with the feature in Windows Explorer where you can start typing a file name and it will jump to the file with the closest name to that which you are typing. I was just wondering whether there was anyway of doing something similar in a form. Where say you could begin to type the last name in a field in a table of customers for example and it would narrow the recordset down based on the letters you are typing.

    The only way I can think of at the moment is to have a select query which is triggered by the textboxes on change event and then set the query as the forms control source. However this seems a little bit unprofessional and may come unstuck.

    Any other ideas?!

  2. #2
    Join Date
    Jan 2004
    Toronto, Canada
    if its linked to a recordset (the field in the form), set Auto Expand to say Yes in the properties box.

    Thats the autocomplete function, if thats wat i'm asumin u want

  3. #3
    Join Date
    Apr 2002
    How about using FindFirst instead of requerying? I think you need at least Acc2k for that to work though.

    Something like that:
    Private Sub TextWhatever_Change()
        Dim rst As DAO.Recordset
        Dim TextLen As Long
        Static OldTextLen As Long
        TextLen = Len(Me.TextWhatever.Text)
        'only search if the user appended something to the search string
        If TextLen > OldTextLen Then
            Set rst = Me.Recordset
            'find the record
            rst.FindFirst "Sortierbegriff LIKE '" & EscapeTicks(Me.TextWhatever.Text) & "*'"
            'let the user continue typing normally
            Me.TextWhatever.SelLength = 0
            Me.TextWhatever.SelStart = TextLen 
        End If
        OldTextLen = TextLen
    End Sub
    Last edited by Apel; 11-15-04 at 11:27.

  4. #4
    Join Date
    Feb 2004
    Chicago, IL
    Probably the fastest way (minimal coding) is to use a combo box and the Auto Expand property set to Yes like Jerrie suggested. If you automatically pop up the combo box list with :

    SendKeys "{F4}"

    In the Got Focus event of the combo box then it will show you more than one name. You can even show as many names as you like with the List Rows property of the combo box.

    The only other way I can think of is turning on Key Preview and putting some code in the On Key Press event of the combo box. Did you want to 'jump' to the best match or filter for the best match? The difference being, the filtering would remove items from the list and the jump would just move up an down the list.

  5. #5
    Join Date
    Dec 2003
    Dallas, TX
    Hi Jammy,

    Not really sure that this is what you wanted but take a look at the sample database I posted here. When the form opens, Tab 3 times to move to the JobNameLookup field...(ComboBox) and start typing either of these words:


    Note, as you type the first "H" it pulls in one of the choices, then type another letter and another. As you fill it in more you get closer to a possible match.

    hope this is what you needed.
    have a nice one,

    Oh, btw, "Welcome to the Forum"
    Attached Files Attached Files

Posting Permissions

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