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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort field by clicking on label 1

Status
Not open for further replies.

air0jmb

Technical User
Sep 8, 2006
38
US
I want to be able to change the 'sort by' on a form by clicking on any field's label.

I'd like something similar to when using Windows, the clicked label sorts that field and displays an up/down arrow to indicate whether that field is sorted A-Z or Z-A.

Thanks!

Mike
 
How are ya air0jmb . . .

[ol][li]In the [blue]Tag property[/blue] of each label to control sorting enter the [blue]corresponding textbox control name![/blue][/li]
[li]In the code module of the for copy/paste the following:
Code:
[blue]Public Sub SortIt(Name As String)
   Me.OrderBy = Name
   Me.OrderByOn = True
End Sub[/blue]
Next in the [blue]On Click[/blue] of each label:
Code:
[blue]   Call SortIt(Me![purple][b][i]ThisLabelName[/i][/b][/purple].Tag)[/blue]
[/li][/ol]
Open the form and test . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top