List that Sorted by a toggle button

  • Thread starter Thread starter kelvin H via AccessMonster.com
  • Start date 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
 
If you are referring to a list box then your code can change the Row Source
property of the list box.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top