Sorting Continuous Form Based on Different Columns in Combo Box

mjseim

Registered User.
Local time
Yesterday, 19:40
Joined
Sep 21, 2005
Messages
62
Greetings,

I use the code below quite often to sort a continuous form based on click on buttons that act as column heads.

Code:
Private Sub ColumnHeaderMemo_Click()
'This will sort the form based on a label click.
    If Me.[Memo].Tag = "desc" Then
        Me.OrderBy = "[Memo] Desc"
        Me.[Memo].Tag = "asc"
      Else
        Me.OrderBy = "[Memo] Asc"
        Me.[Memo].Tag = "desc"
    End If
    
    Me.OrderByOn = True
End Sub

The problem is that sometimes I want to sort on a field in a combo box that is not the bound field. That is, if my bound field is actually in, say, column 3 and hidden it is still sorting by this field. Rather than that, I want it to sort by the column that is displayed... column(0). When I add .column(0) or any variant, the code errors out.

Does anyone have any idea how to do this?

Thanks.
 

Users who are viewing this thread

Back
Top Bottom