Include date sorting in a VBA filter button (1 Viewer)

gojets1721

Registered User.
Local time
Today, 15:29
Joined
Jun 11, 2019
Messages
429
Hi so my form has a button that when pressed, it filters down to certain entries. However when it filters, it no longer sorts the entries from oldest to newest by date. It's just randomly mixed up. Is there anyway to include something in the code that will sort from oldest to newest by date?

The VBA code that I am using for the button is:

Code:
Private Sub btnNotStarted_Click()
    DoCmd.ApplyFilter , "[Status]= 'Not Started'"
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:29
Joined
May 7, 2009
Messages
19,169
Can you add to the code:

DoCmd.SetOrderBy "[Entry Date Fieldname] DESC"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:29
Joined
Feb 19, 2002
Messages
42,976
Is the date sort in your RecordSource query?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:29
Joined
Feb 19, 2002
Messages
42,976
Which worked? It helps people who find this thread later to know what actually worked for you.
 

Users who are viewing this thread

Top Bottom