List that Sorted by a toggle button

  • Thread starter kelvin H via AccessMonster.com
  • Start date
K

kelvin H via AccessMonster.com

How can I sort the list of a resulted query (lstShow) by simply clicking the
toggle button (say, sort by product name in descending order)?

Thanks
 
D

Duane Hookom

If you are referring to a list box then your code can change the Row Source
property of the list box.
 
G

Graham R Seach

Kelvin,

Private Sub togMyToggle_AfterUpdate()
Dim sSQL As String

sSQL = "SELECT blah FROM Table1"

If (Me!togMyToggle = True) Then
sSQL = sSQL & " ORDER BY ProductName Desc"
Else
sSQL = sSQL & " ORDER BY ProductName" 'Ascending order
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Top