> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Viewer Question: Sort a Continuous Form by Clicking on the Column Label of a Combo Box
- URL: https://nolongerset.com/newsort-combo/
- Published: 2024-01-12T04:44:39.000Z
- Updated: 2026-05-08T12:38:01.000Z
- Description: My NewSort() function lets you easily add support for giving users a way to sort your continuous forms. But how do we sort by combo boxes' displayed text?
- Author: Mike Wolfe
- Tags: Form Design, #Import 2026-05-20 02:59

Over on my YouTube channel, a [viewer asked](https://www.youtube.com/watch?v=Rlw2W1qr2O0&lc=UgwlmOrWa1rSAGTHjCZ4AaABAg) the following question about my [NewSort() function](https://nolongerset.com/newsort/):

> Hi, this is great. I was wondering how this would work with a combo box. It just references the id number, but I'd like to sort by the displayed text.  
> \-@kathymatossian

Great question, Kathy!

Here's an excerpt from my original NewSort article for reader context:

---

## Usage

There are usage notes in the code comments, but here is the high-level overview:

1. Create Label controls in the Form Header section to serve as column headers
2. Set the On Click event for each label to `=NewSort([Form], "MyColumnName")`
3. \[OPTIONAL\] Set the On Mouse Move event to `=UseHand()`
4. \[OPTIONAL\] Set the form's On Load event to `=NewSort([Form], "MyFirstColNameToSortBy", "MySecondColNameToSortBy")` (*passing multiple field names resets the form's Order By property*)

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-1-1.png)

---

## A Simple Example

Let's create a new form based on a *Person* table with the following structure:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-17.png)

The PositionID field is a foreign key to the *Position* table, shown below:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-18.png)

To begin, we'll create a very simple continuous form bound directly to the *Person* table (i.e., the form's RecordSource property is `Person`):

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-19.png)

I've included three controls on this simple form:

1. Text box bound to *FirstName*
2. Text box bound to *LastName*
3. Combo box bound to *PositionID*

I added calls to the **NewSort()** function in the On Click event for the two text box labels as follows:

- First Name label On Click: `=NewSort([Form], "FirstName")`
- Last Name label On Click: `=NewSort([Form], "LastName")`

Clicking on either label will sort the records in ascending order for the respective field. Clicking a second time will switch the order to descending. See the original article and/or YouTube video linked above for more details.

So far, so good. 

## Combo Box Challenges

We're left now with the Position combo box.

Here's the RowSource for the combo box:

```sql
SELECT PositionID, PositionAbbrev, PositionName 
FROM [Position] 
ORDER BY Seq; 
```

NOTE: The table name "Position" is in square brackets above because it's a Jet reserved word. I forgot to check Allen Browne's web page of "[bad words](https://nolongerset.com/bad-words-in-access/)" when creating my sample table.

This is a typical example of an Access combo box where the control is bound to a Long Integer foreign key field. The combo box itself is populated with data from the foreign lookup table. The bound column is hidden from the user by setting the first column width to 0". The last visible column is set to 0.1" to prevent Access from displaying a horizontal scroll bar if I don't set the List Width property wide enough.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-21.png)

Since the PositionID is a surrogate key, it is meaningless to the user. It makes no sense to sort by this field. However, if we look at the current field list (via Form Design > Add Existing Fields) we see that PositionID is the only field related to the Position table in our form's current record source:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-22.png)

As Kathy alluded to in her comment, there's no way to get at the description fields from the combo box. 

So, how do we allow the user to sort the form by the PositionName field?

## Sorting by Combo Box Descriptions

The short answer is that we need to **include any columns we want to sort by in the form's RecordSource**.

In other words, we need to change the form'sRecordSource from `Person` to:

```sql
SELECT Pe.PersonID, 
       Pe.FirstName, 
       Pe.LastName, 
       Pe.PositionID, 
       Po.PositionAbbrev
FROM Person AS Pe 
  LEFT JOIN [Position] AS Po ON Pe.PositionID = Po.PositionID;
```

*Note that we use a Left Outer Join to show all the Person records even if they do not yet have a PositionID value.*

Now that *PositionAbbrev* is one of the fields in the form's RecordSource, we simply set the Position Label's On Click event to:

```
=NewSort([Form], "PositionAbbrev")
```

The screenshot below shows the form when first loaded (Left), after clicking the Position label once (Middle), and after clicking it a second time (Right).

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2024/01/image-23.png)

## Sorting Memory

The screenshots above also demonstrate the sort "memory" feature of the **NewSort()** function. 

Rather than replacing the existing sort, the NewSort function simply "demotes" the existing sort and prioritizes sorting by the most recently clicked field. When initially loaded, the form above sorts by First Name. If you look carefully in the two screenshots to the right, you will see that within position groups, the players continue to be sorted in First Name ascending order.

### Referenced Articles/Videos

[NewSort(): Sort a Continuous Form by Clicking on the Column LabelSort a continuous form in MS Access by simply pointing at a column label. These functions make it easy.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/09/NewSort.jpg)](https://nolongerset.com/newsort/)

[NewSort(): Sort a Continuous Form by Clicking on the Column Label](https://www.youtube.com/watch?v=Rlw2W1qr2O0)