1
votes

I have a Form with a (Continuous) Subform that lists the results of a query. There's a header within the Subform that has several elements you can click on to programatticaly change the OrderBy of the Subform then refresh it. An example of the code I use is here:

Private Sub CompanySort_Click()
    If (Me.OrderBy = "Company") Then
        Me.OrderBy = "Company DESC"
    Else
        Me.OrderBy = "Company"
    End If
    Me.Refresh
End Sub

This works fine when the Form (which is named "Results Subform") is run by itself, but doesn't work when run as part of the parent Form ("Results"). The name of the Subform control is "Report subform", can't remember why it's different now...

What am I doing wrong? I'm sure it's simple, but I'm stumped, any help is much appreciated.

1
The problem was resolved here: bytes.com/topic/access/answers/…Sinister Beard

1 Answers

3
votes

To keep the answer with the question, and leave an artefact for the next person with this problem.

The solution was to toggle Me.OrderByOn to True

Me.OrderByOn = True

(toggling it to False and then True may also help if you are doing subsequent changes to the OrderBy field)