Sort by Any Field (Cursor Location)

  • Thread starter Thread starter mindlike
  • Start date Start date
M

mindlike

I have an unbound form with ~ 25 fields. I would like to create A-Z and Z-A
command buttons that when clicked will sort DESC/ASC based on which text or
combo box the cursor is located in. Functionality that is available on the
pre-canned forms that are bound. Coding for a filter button would be great
as well.

As always thank in advance for any help.
 
You don't need those buttons. Here is a much simpler way to do it and more
intuitive for a user. Put this code in your form's code module:

Private Function ComeToOrder()
Me.OrderBy = Screen.ActiveControl.ControlSource
Me.OrderByOn = True
End Function

Then for each control you want to be able to sort on, put this in the double
click event text box of the properties dialog:

=ComeToOrder()
 
Back
Top