G
Guest
Hi all,
I have a problem with sorting records from within visual basic.
I use the On Click property of a command button:
=SortForm([Form], "[Global Title]")
etc.
with this function in a standard module:
Function SortForm(frm As Form, ByVal sOrderBy As String) As Boolean
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
End If
End Function
I seems to work ok, but it does not the second time i click on the button:
in fact the second time, it should reverse the sort order. Instead it removes
the content of the field.orderby property and displays the original records
from the record source without any sort order.
So the DESC instruction is not accepted.
Can anyone help me on this ?
I have a problem with sorting records from within visual basic.
I use the On Click property of a command button:
=SortForm([Form], "[Global Title]")
etc.
with this function in a standard module:
Function SortForm(frm As Form, ByVal sOrderBy As String) As Boolean
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
End If
End Function
I seems to work ok, but it does not the second time i click on the button:
in fact the second time, it should reverse the sort order. Instead it removes
the content of the field.orderby property and displays the original records
from the record source without any sort order.
So the DESC instruction is not accepted.
Can anyone help me on this ?