Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: combo box property help

    hello i am a new programmer in access. i just need u'r help if u know how to set the properties of the combo box so that if the user clicks the alphabet "C" then all the items in the list with "C" as starting alphabet are top in the list . this phenomenon is used if we have multiple entries starting from "A" to "Z" .
    and i wish to include the all field in my combo box list how to do that.
    plz help out. email at

  2. #2
    Join Date
    Jan 2002
    Bay Area
    I would do it this way. Set up a separate combo box that displays only the first unique letter of the items in your alpha-sorted list.

    When you click on the arrow of your new combo box, the list of all available letters will be displayed. Set the combo box size to the number of letters available (which will fit on your screen if your form is large enough and you position the combo box correctly on the form) as in the following example code:

    Me!Combo1.ListRows = Me!Combo1.ListCount

    This combo box should only expand and display up to 27 letters of the alphabet when you click on the arrow.

    You fill this combo box with available letters (the example below applies to records in the table MyTable, and a field named Description) :
    Me!Combo1.RowSource = "SELECT Left([Description],1) AS Descr FROM [MyTable] GROUP BY Left([MyTable]![Descr],1);"

    In the AfterUpdate event of Combo1 (when a letter has been selected) you loop through the items in your alpha-sorted list, I'll call BigCombo, looking at the first letter of each item to match to the chosen letter or find a value greater than the chosen letter:

    Target = Me!Combo1.Text
    j = Me!BigCombo.ListCount
    For i = 1 To j
    TestChar = Left(Me!BigCombo.Column(1, i)
    If TestChar = Target Or TestChar > Target Then Exit For
    Next j

    Here is code that works for me in positioning the the found target at the top of the combo list and removing traces of selection (dotted lines and highlighed row) from the combo box:
    Me!BigCombo.Selected(j - 1) = True
    Me!BigCombo.Selected(j - 1 ) = False
    Me!BigCombo.Selected(i) = True
    Me!BigCombo = Null

    Besides choosing from a list of letters you can also allow the form user to enter a letter in Combo1 as a target.

    Good luck if you experiment with this solution.


Posting Permissions

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