Results 1 to 2 of 2
  1. #1
    rdirosato is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    8

    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

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    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 

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 02-09-2010, 07:53 AM
  2. How to sort by three sort orders
    By captgnvr in forum Access
    Replies: 4
    Last Post: 11-09-2009, 07:30 AM
  3. Replies: 3
    Last Post: 10-16-2009, 07:54 AM
  4. Macro to Run RemoveFilter/Sort
    By Ryan in forum Access
    Replies: 0
    Last Post: 08-30-2009, 01:41 AM
  5. Sort
    By mmp97 in forum Access
    Replies: 1
    Last Post: 12-18-2008, 10:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums