Position one value at the top in a combo box

Posted on 2014-07-15
Last Modified: 2014-07-15
Hello Experts
Wondered if there is an (easy) way to do this.

I have a combo box listing the records in a table.  I would like the listing to be sorted alphabetically EXCEPT for one particular entry to appear at the top.  I don't really want to call it AAAentry.

This is not vital, but I would like to do it if possible.

Is this possible?


Question by:rltomalin
    LVL 25

    Assisted Solution

    by:Shaun Kline
    If you have the ability to change the table design, an easy way would be to add a number field that "groups" the entries, giving the value that you want at the top a lower number, and then modify the query that loads the combo box to sort by grouping and then by name.

    If you do not want to do this by changing the table design, a similar option can be done using the IIF statement in the sort order.
    LVL 47

    Accepted Solution

    I generally use a union query, something like:

    SELECT myCombo.Field1
    FROM (
    SELECT [Field1], [Field1] as SortOnThis FROM your Table
    SELECT "Put this one first", "" FROM tblNumbers
    WHERE lngNumber = 0
    ) as myCombo
    ORDER BY myCombo.SortOnThis

    I have a table in all of my databases "tblNumbers", which contains a single field (lngNumber) and 10 values (the numbers 0-9) for use in cases like this.

    Author Closing Comment

    Thanks for the prompt feedback.  Not sure which solution I will use yet.

    Best regards


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now