View Full Version : Sorting


twosides
04-04-2007, 10:09 AM
I use this code to sort aphabetically on a field. Double clicking the header (DeptLbl) simply sorts it fine.
But I want it to sort it on this field first but then on a sub field called 'Room'.

In other words I want it in Department order first followed by Room order next.

Any ideas ???

Cheers



Private Sub DeptLbl_Click()
If Me.OrderBy = "[Department]" Then
Me.OrderBy = "[Department] DESC"
Else
Me.OrderBy = "[Department]"
Me.OrderByOn = True
End If
End Sub

FoFa
04-04-2007, 11:24 AM
Order by takes a list of columns, so [Department], [Room] would sort by department first, then room. The DESC options can be used also for each column as such.
[Department] DESC, [Room] for desc. department and asc. room or
[Department] DESC, [Room] DESC for descending on both