I have a continuous form that has a combo box that allows users to pick a list of contacts that are stored in a Contacts table.
The Control Source is a numerical field called "Contact" that is in the main table.
The Row Source is from the Contacts table where the bound column is column 1, but since I made that column width 0 length, the combo box displays the 2nd row which is the LastName of that contact. So far so good.
I would like the user to sort that column in either ASC or DESC.
So made a command button that toggles the sort. It goes like this
Me.OrderByOn = True
If Me.OrderBy = "[Contact] DESC" Then
Me.OrderBy = "[Contact] ASC"
Else
Me.OrderBy = "[Contact] DESC"
End If
The problem is that this sorts the Contact's ID number in the main table and not by the last name that is being displayed in the combo box.
How can I change my code to sort by the second column of my combobox?
Thanks
The Control Source is a numerical field called "Contact" that is in the main table.
The Row Source is from the Contacts table where the bound column is column 1, but since I made that column width 0 length, the combo box displays the 2nd row which is the LastName of that contact. So far so good.
I would like the user to sort that column in either ASC or DESC.
So made a command button that toggles the sort. It goes like this
Me.OrderByOn = True
If Me.OrderBy = "[Contact] DESC" Then
Me.OrderBy = "[Contact] ASC"
Else
Me.OrderBy = "[Contact] DESC"
End If
The problem is that this sorts the Contact's ID number in the main table and not by the last name that is being displayed in the combo box.
How can I change my code to sort by the second column of my combobox?
Thanks