Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Access

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-11-2010, 08:51 AM
rdirosato rdirosato is offline Windows XP Access 2007 (version 12.0)
Novice
 
Join Date: Mar 2010
Posts: 8
rdirosato is on a distinguished road
Default Macro Button to Sort Field A-Z

Hello,

Say I have a report or form with some columns like below


Name.........Number........Phone
Rob............222..............222
Joe.............111..............333

What I'm trying to do is create a macro that when the title name (Name Number Phone) is clicked it will sort the column a-z

Thanks in advance for your help
Reply With Quote
  #2  
Old 03-11-2010, 07:32 PM
ajetrumpet ajetrumpet is offline Windows Vista Access 2007 (version 12.0)
Advanced Beginner
 
Join Date: Mar 2010
Location: iowa city, ia
Posts: 83
ajetrumpet is on a distinguished road
Send a message via MSN to ajetrumpet Send a message via Yahoo to ajetrumpet
Default

i believe you do this using the ORDERBY property. so on the click on each label that holds the field names, put something like this on the click event property:
Code:
=sortfield("fieldname""formname"
then write a universal function like this:
Code:
public function sortfield(fld as stringfrm as string)

forms(frm).orderby fieldname
forms
(frm).orderbyon true
forms
(frm).requery

end 
function 
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit Button:How can I assign a button to go to the next record and its first field? nitinrao Forms 6 02-09-2010 04:53 AM
How to sort by three sort orders captgnvr Access 4 11-09-2009 04:30 AM
Macro tools wizard / making a button to open a form oddsteven Forms 3 10-16-2009 05:54 AM
Macro to Run RemoveFilter/Sort Ryan Access 0 08-29-2009 11:41 PM
Sort mmp97 Access 1 12-18-2008 07:14 PM


All times are GMT -8. The time now is 08:14 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.