Sort not working

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Sort not working

Post by Egg 'n' Bacon »

HI.

I've added some sort buttons to a form, but I'm not sure why they're not working.

Could someone have a look please & tell me where I'm going wrong.

TIA
Database8.zip
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Sort not working

Post by HansV »

You're setting OrderBy to a field and then setting OrderBy to True - that makes no sense. After setting OrderBy to a field, you must set OrderByOn to True to make the sort order active. There is no need to set OrderByOn to False first.

Code: Select all

Private Sub FirstNameUp_Click()
    Me.OrderBy = "FirstName"
    Me.OrderByOn = True
End Sub
etc.
Best wishes,
Hans

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Sort not working

Post by Egg 'n' Bacon »

Doh! :bash:

That's what comes from rushing.

Thank you muchly.

I had put in the 'OrderByOn to False' to negate any other sort that had been put on the recordset.