I have a database of volunteers and I want to sort them with one button. Initially when the form is loaded the volunteers are sorted Ascending, I believe....so I need a toggle button that shows the image for Desending and when it is click the image changes to a Ascending image, i.e. A->Z and sorts them.
This make sense? I need to sort the volunteers by there LastName.
this is some code that i'm working with now....but
This code below does sort of what I am looking to do. But it does not change the image icon and i have to hold the shift key to get it to sort Ascending to Desending... I would like to eliminate the need for holding the shift key down and I want the images to change....thought this code might help spark something...
Private Sub Sort_LastName_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Application.Echo False 'Turn Echo off to Prevent flicker
If Shift = 1 Then 'Is the Shift Key pressed (1 = yes : 0 = No)
Me.OrderBy = "[LastName] DESC" 'The table item to base the sort from.
Me.OrderBy = "[LastName]" 'The table item to base the sort from.
Me.OrderByOn = True 'Turn ON the Sort
Me.Requery 'Requery the Form
Application.Echo True 'Turn Echo back on
You can also do it with on Toggle button (Up value = False, Down Value = True) and paste the code I've posted with minor modifications. Also, you may be able add the standard graphic .bmp's that comes with Access, for sort AZ or ZA.