Sort records

neilmcmor

Registered User.
Local time
Today, 02:04
Joined
Aug 9, 2007
Messages
70
I have a button on a form with the following code on click. This sorts the records in Ascending order. How would I modify the code to sort in Descending order.

Private Sub SortName_Click()
On Error GoTo Err_SortNameBtn_Click

'Sorts the records by Surname in Ascending order

Me.OrderBy = "Surname"
Me.OrderByOn = True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_SortNameBtn_Click:
Exit Sub

Err_SortNameBtn_Click:
MsgBox Err.Description
Resume Exit_SortNameBtn_Click


End Sub
 
Looking in Help would have revealed:

Me.OrderBy = "Surname DESC"
 

Users who are viewing this thread

Back
Top Bottom