Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Welcome to the skill header Forums. You can ask questions, get help, or help other members out. Join our Forum for free.

Column Sorting Asc/...
 
Notifications
Clear all

Column Sorting Asc/Des

9 Posts
2 Users
0 Reactions
35 Views
FStetson
Posts: 12
Topic starter
(@fstetson)
Eminent Member
Joined: 2 weeks ago

In this project you deploy column sorting as dependent on a sorting mode selection group. using this code;  

Private Sub CmdItmType_Click()
If Me.FrameItmSort = 1 Then
DoCmd.SetOrderBy "ItmType ASC"
Else
DoCmd.SetOrderBy "ItmType DESC"
End If
End Sub

I lean to using labels with just the following code, as most users are used to having an asc/dsc sort feature built in and saves the user from having to go back and forth. 

Private Sub EquipmentName_Label_Click()
If Me.OrderBy = "EquipmentName" Then
Me.OrderBy = "EquipmentName desc"
Else
Me.OrderBy = "EquipmentName"
End If
End Sub

Knowing there many different ways to skin a cat.  Is there a business process that prefers this one over the other, or is it just your preference?

Fred

8 Replies
Posts: 5
 ursh
Admin
(@ursh)
Member
Joined: 6 months ago

Thanks for sharing this wonderful information. I have tried different methods including the one you have described. You know the indication of typical sorting is the icon switching from up to down or down to up depending on the Asc or Desc mode but it is not possible in your method neither mine and on the other hand I would like to know which method a user is applying. So, simply, I create an Options group mentioning Asc or Desc mode to select.

I am hoping that we could make it possible and innovate an automated process of indicating both orders from the label of each column.

Reply
FStetson
Posts: 12
Topic starter
(@fstetson)
Eminent Member
Joined: 2 weeks ago

Interesting.  Then maybe to help the user see what mode they are in, the icons could be faded until clicked.  That way only the asc arrow, or the dsc arrow would clearly visible.  I still kind of like my way, lol.😂 

Reply
FStetson
Posts: 12
Topic starter
(@fstetson)
Eminent Member
Joined: 2 weeks ago

Forgot to address your last statement.  I do have an idea floating in my head to automate and indication on the label to show which sort option is in play.  Give me a day or two to run this around the bush.  If anyone else has an idea, please jump in.  Looking at creating a class module for function to be called.

Reply
FStetson
Posts: 12
Topic starter
(@fstetson)
Eminent Member
Joined: 2 weeks ago

Well, I made some progress and need help finishing this off.  It works fine, but I am having a problem with making the cmd button picture returning to default. "ASC arrow"  You have to establish the path to the images you want to use, I am using my desktop as you can see.

Here is the code I have so far....

Private Sub CmdAccCode_Click()
'If Me.FrameItmSort = 1 Then
If Me.OrderBy = "AccCode" Then
DoCmd.SetOrderBy "AccCode DESC"
Me.CmdAccCode.Picture = "C:\Users\Owner\Desktop\sort z-a.png"
Else
DoCmd.SetOrderBy "AccCode ASC"
Me.CmdAccCode.Picture = "C:\Users\Owner\Desktop\sort a-z.png"
End If

End Sub

Comments? Suggestions?

Reply
Page 1 / 2
Share: