Christine Pearc
Christine
- Local time
- Today, 23:23
- Joined
- May 13, 2004
- Messages
- 111
I have a form that allows the user to specify, among other things, date ranges for data to be displayed in a subform (in a form, not datasheet).
In the subform, the user can click any column heading to sort the records by record number, employee name, department, etc. The Click event calls a function:
Here's the function module code:
This works great - except on date fields, which are set to the medium date format as DD-Mmm-YY. I end up with a sort list that looks like this:
Many thanks
Christine
In the subform, the user can click any column heading to sort the records by record number, employee name, department, etc. The Click event calls a function:
PHP:
Private Sub lblReviewDate_Click()
Call SortForm(Me, "ReviewDate")
End Sub
Here's the function module code:
PHP:
Function SortForm(frm As Form, ByVal sOrderBy As String) As Boolean
'Sort form column headings OrderBy to the string. Reverse if already set.
If Len(sOrderBy) > 0 Then
' Reverse the order if already sorted this way.
If frm.OrderByOn And (frm.OrderBy = sOrderBy) Then
sOrderBy = sOrderBy & " DESC"
End If
frm.OrderBy = sOrderBy
frm.OrderByOn = True
SortForm = True
End If
End Function
21-Apr-05
24-Jun-05
29-Jun-05
11-Jul-05
05-Apr-05
07-Jun-05
A sort in the reverse direction is equally messed up. Can someone advise what to do about this?24-Jun-05
29-Jun-05
11-Jul-05
05-Apr-05
07-Jun-05
Many thanks
Christine