thread702-1516961
I found the above thread where someone posted the below code that works great for creating a sort button for a list box on a form.
The only problem that I can't seem to solve is that I lose the formatting in the fields that I sort. For example, I have a total field that has the currency formating and when I use the sort button, I lose that formatting, same for my date column.
Would anyone be able to guide me pls in finding a way to maintain my formatting.
------------------------------
Private Sub cmd1_Click()
Dim rs As DAO.Recordset
Set rs = Me.List1.Recordset.Clone
If cmd1.Tag = "OrderID" Then
cmd1.Tag = "OrderID DESC"
Else
cmd1.Tag = "OrderID"
End If
rs.Sort = cmd1.Tag
Set rs = rs.OpenRecordset
Set Me.List1.Recordset = rs
end sub
---------------------
Thanks
Martin
I found the above thread where someone posted the below code that works great for creating a sort button for a list box on a form.
The only problem that I can't seem to solve is that I lose the formatting in the fields that I sort. For example, I have a total field that has the currency formating and when I use the sort button, I lose that formatting, same for my date column.
Would anyone be able to guide me pls in finding a way to maintain my formatting.
------------------------------
Private Sub cmd1_Click()
Dim rs As DAO.Recordset
Set rs = Me.List1.Recordset.Clone
If cmd1.Tag = "OrderID" Then
cmd1.Tag = "OrderID DESC"
Else
cmd1.Tag = "OrderID"
End If
rs.Sort = cmd1.Tag
Set rs = rs.OpenRecordset
Set Me.List1.Recordset = rs
end sub
---------------------
Thanks
Martin