Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change sort order on continuous form? 1

Status
Not open for further replies.

jebushatescats

IS-IT--Management
Jun 6, 2006
37
0
0
CA
Hello all

I have continuous form that displays records in a recordset, each record has 7 fields.
The user would like to take the records that are displayed on the form and change the order in which they appear on the form(re-sort them) They would like to be able to do this on the fly, as the app is running. Can anyone point me in the right direction as to how I can do this. Keeping it as simple as possible from the end users view point.

thanks in advance for any replies
 
Hey all
To answer my own question
I did the following
Each row in my form is made up of 7 fields with a label at the top of the form describing what is in the field
For example I have a field that containing a status code and the label is called Status_Label
The following code will sort the records by status in ascending order

Private Sub Status_Label_Click()
' reorder data on form sort by status
Me.OrderBy = "Status"
Me.OrderByOn = True
End Sub
 
A little enhancement ?
Private Sub Status_Label_Click()
' reorder data on form sort by status
If Me.OrderBy = "Status" Then
Me.OrderBy = "Status DESC"
Else
Me.OrderBy = "Status"
End If
Me.OrderByOn = True
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya jebushatescats . . .

See my post here thread702-1356401

Calvin.gif
See Ya! . . . . . .
 
Ok I've got a similar problem but I want to be able to sort a subform. I get an error that the method is not supported when I try to use the orderBy method. Maybe my syntax is wrong? Take a look...

Code:
Forms!EquipmentQueries_frm!qsMaintenanceTrackingsubform.OrderBy = "DateRequested"

 
Perhaps this ?
Forms!EquipmentQueries_frm!qsMaintenanceTrackingsubform[!].Form[/!].OrderBy = "DateRequested"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top