OrderBy on Datasheet Problem.

Bilbo1161

New member
Local time
Today, 19:31
Joined
Jul 3, 2017
Messages
7
Hi
I am using Navigation Forms in my database and would like to sort the order of a datasheet on a toggle button.

The structure I have is

Main
Contractors Details
Datasheet

All the examples I have seen, show the property of Me.OrderBy being checked to see which field has been ordered by and then sets either ascending or descending accordingly.

When I try and use this method it doesn't work. I'm assuming I have to reference this differently but cannot see how.

The button resides in the Contractors details form, with the Datasheet a subform of this.

Any help would be appreciated.
 
the code should be, for the subform:

Code:
sub togBtn_Afterupdate()
sFlt = "ORDER BY " & Me.OrderBy
if togBtn.value then
   me.subform.Filter = sFlt 
   me.subform.filterOn = true
else
   me.subform.Filter = sFlt & " DESC"
   me.subform.filterOn = true
endif
end sub
 
Sorry, when I said toggle button, I just meant a standard button that has the ability to sort in either ascending or descending.
This would be done by checking if the field had previously been sorted ascending or descending.
 

Users who are viewing this thread

Back
Top Bottom