Type Ahead Code for Access 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • biotechie
    New Member
    • Dec 2008
    • 2

    #1

    Type Ahead Code for Access 2003

    I have been trying to use this code to enable the type ahead function in a combo box within a form that I am using. The combo box contains the id#, old compound number and new compound number. What is the simplest way to enable the type ahead function?



    This is the code I am using:

    Code:
    Private Sub cboCompound_Number_Change()
    Dim strTyped As String
      Dim strSelect As String
      strTyped = Nz(cboCompoundNumber.Text, "")
      If Len(strTyped) = 3 Then
        strSelect = "SELECT CompoundList.ID, NewPMXCompoundNumber, OldPMXCompoundNumber FROM CompoundList " & _
           "WHERE CompoundNumber LIKE """ & strTyped & "*"" " & _
           "ORDER BY CompoundNumber;"
           cboCompoundNumber.RowSource = strSelect
           End If
    End Sub
    This is my first time writing code and using Access. The easier the better.

    Any assistance will be appreciated.

    Thanks
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    You don't need any VBA code! The Auto Expand property, what you are calling "type ahead function" is the default for comboboxes, and if it's been turned off, can be turned on again by selecting the combobox and going to Properties - Data and setting Auto Expand to Yes.

    Your duplicate posting of this question/problem has been deleted! Please refrain from this prohibited behavior in the future.

    From FAQs

    Do Not Double Post Your Questions

    Double posting is where you start a thread on a topic and then for some reason start another thread on exactly the same topic in the same forum. Please do not do this because

    1. It makes it very hard for people to answer you especially if there are answers happening in all the threads you have started because they have to read 2 or more threads in order to see what has already been said.

    2. It swamps the forum with your problem resulting in less attention for the other threads.

    If you feel for some reason that you post has been overlooked (for instance it hasn't had any replies) please do not repost the question. Post a message to the thread you started, this will bump it back to the top of the thread list for the forum.

    Thank you for your attention in this matter.

    Welcome to Bytes!

    Linq ;0)>

    Moderator

    Comment

    • biotechie
      New Member
      • Dec 2008
      • 2

      #3
      type ahead vb code

      Thank you! It works fine!

      My first time posting. Sorry for the double posts.

      Comment

      Working...