Continuous Form Sorting Question

jcruzAME

Registered User.
Local time
Today, 13:02
Joined
Oct 5, 2011
Messages
135
While it seems simple enough to right click and select small to large, low to high etc., is there a way to code a double click event that sorts the form?

For example, they double click on the header and in the code I run something that sorts by that column.

Is there a simpler way to do that other than setting the record source again and placing an order by on the end with the appropriate column name?
 
This type of thing?

Code:
Private Sub lblEmployeeID_DblClick(Cancel As Integer)
  Me.OrderBy = "EmployeeID, StartDate Desc"
  Me.OrderByOn = True
End Sub

Private Sub lblStartDate_DblClick(Cancel As Integer)
  Me.OrderBy = "StartDate Desc"
  Me.OrderByOn = True
End Sub
 
I'll try that and post back on the results.

EDIT: It worked, but there's not real noticeable difference in speed. Thanks for the help!
 
Last edited:
...but there's not real noticeable difference in speed
Did I miss something here? I didn't see any mention in your original post about speeding up the sorting! You question was "...is there a way to code a double click event that sorts the form?"
 
Yeah I know, I was just making an observation. I thought that maybe it would.
 
Glad it worked for you. My gut instinct is that there wouldn't be a noticeable speed difference on smaller data sets. There might be on larger ones, since I don't think the data would be re-queried to change the sort. That's untested though.
 
I've never run into a speed problem, in my work, but I seem to remember that having Fields that are Indexed will increase the speed of operations such as Sorting.

Maybe someone with more experience with larger apps can comment on this.

Linq ;0>
 

Users who are viewing this thread

Back
Top Bottom