Just change Case False to:
Me.OrderBy = str
Me.OrdderByOn = True
John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Bill Basile
Sent: Friday, May 12, 2006 2:15 AM
To: [email protected]
Subject: [ms_access] Command button to sort records on a form
Could someone help with this?
It should be really simple -- but I've looked everywhere and I couldn't
find it.
Basically, I'm just looking for a button that can toggle between sort
ascending and sort descending on a form. It can be done with a right-click
menu item, so I figured it would be simple code.
I found this in an Access 97 book, but it only works on the ascending.
Dim str As String, tgl As ToggleButton
str = "Forms!frmViewAll!lblDESCRIPTION"
Set tgl = TglDescription
Select Case tgl.Value
Case True
Me.OrderBy = str & " DESC"
Me.OrderByOn = True
Case False
Me.OrderBy = str & " DESC"
Me.OrderByOn = False
End Select
End Sub
===============
I think the problem is with the line Me.OrderBy = str $ " DESC"
The code now will go from unsorted to sort ascending, but it won't toggle
to the sort descending.
Thanks in advance for your help.
Bill
Yahoo! Groups Links
YAHOO! GROUPS LINKS
- Visit your group "ms_access" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
