Results 1 to 6 of 6
  1. #1
    Carouser is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Location
    Melbourne, Australia
    Posts
    56

    Create Sort Order Customization Thingy

    I am inquiring whether it is possible to to create a sort ordering procedure like you find when you have a group of records, select any one record and you can use the up and down keys to re-order that record moving to any position in the hierarchy from first through last position. I would like to create a presenter ordering system, i,e the order which presenters will present in a session. I'm not sure what this function is called and so don't know what to look for, or if it is even possible with VB.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    Sort has to be done on data in a field. You would have to assign a value (number, alpha, or date/time) to each record that would determine the hierarchy of order.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Carouser is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Location
    Melbourne, Australia
    Posts
    56
    I understand that I would have to create an extra field in the appropriate table, I just do not know the logic behind how it would work if I wanted to re-order any of the fields especially just swapping the order without having to manually remove the numbers and re-insert in the order required. . The closest I have found is the "Rank function", though it does not give me the ranking gui that I was wanting.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Further to June7's comment, if you have some sort order that doesn't follow Name or Amount order etc, and you can define it, you can add another field in a table eg MySortField
    and make the order whatever you want/need. Then use that fields values to present/sort the data according to your field/values.

    I have used such a field when we had bilingual data, and wanted the values in a "agreed upon" sort order .

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,942
    The values in the 'hierarchy' field would have to be edited, manually or with code.

    EDIT (inspired by Paul's post following this one): A SQL UPDATE action could modify all the other records to add or subtract 1 from the hierarchy value, assuming a number type, depending on direction of move. The UPDATE would need criteria to exclude the record being 'moved' and possibly also criteria limiting to a particular group of records. I helped another poster with this long time ago, wish I could find it.

    Google: access vba move record up down
    here is one
    http://www.accessmonster.com/Uwe/For...-within-a-form
    Last edited by June7; 09-04-2012 at 01:07 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,522
    If the numbers are contiguous, you can simply add or subtract 1 from the record you're on:

    Me.Whatever = Me.Whatever + 1

    and run an update query to add or subtract 1 from the appropriate record (the record with the value 1 higher or lower than the record you're on). You'd want to do that first so you don't reset the record you're on.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Sort order with null values
    By Alsail77 in forum Access
    Replies: 23
    Last Post: 08-27-2012, 05:04 PM
  2. Sort order in a sub form
    By roar58 in forum Forms
    Replies: 1
    Last Post: 03-17-2012, 08:57 PM
  3. Sort order by Dlookup field
    By 1Giggles in forum Forms
    Replies: 1
    Last Post: 02-22-2012, 02:13 PM
  4. Report will order/sort 4 columns but not 5. Why?
    By TomHolden in forum Reports
    Replies: 6
    Last Post: 12-17-2011, 04:25 PM
  5. Sort Order Variation with nulls
    By jonsuns7 in forum Queries
    Replies: 1
    Last Post: 10-09-2009, 03:10 AM

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