Results 1 to 6 of 6
  1. #1
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74

    Sorting on a form

    Hi,
    I have this form for data entry. I want to sort a field in a certain way which is neither ascending nor descending. The items in this field should be ordered as say, C, A, D, B. What I want is a custom order. How can we do it?


    The field I am referring to is not on this form, but in the underlying table.
    I am thinking of a VB code to achieve this purpose, where I can define the order. But not sure how to do it.
    Any help is greatly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    There is only ASCEN or DESC. Need a field in table or query that has value you can use to get the desired order. What are your rules for the order you want?
    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
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    The field I am referring to contains names of certain subjects. The order I want is: Computer Science, Biology, Political Science, Computer Application (in this order). I temporarily solved it by creating separate forms for each.
    Any way to do it as one form, in the given order?

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Create a sort field in your record and value it such that it sorts in the order you want.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    If you have only the 4 items, an expression in query can calculate a field that can be used to sort by.

    Switch([fieldname]="Computer Science",1, [fieldname]="Biology",2, [fieldname]="Political Science",3, [fieldname]="Computer Application",4)

    Otherwise, build a table of these values and have a field for SortOrder value. Join this table to the data table in query.
    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
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    That was indeed great. I did as directed, and got it right. Thank you very much.

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

Similar Threads

  1. Sorting a report using combo box on a form.
    By sanjayakalpage in forum Reports
    Replies: 1
    Last Post: 01-21-2015, 11:44 PM
  2. Sorting/Filtering a continuous form
    By Reaper in forum Forms
    Replies: 3
    Last Post: 01-30-2013, 03:07 PM
  3. Replies: 11
    Last Post: 01-12-2012, 07:55 PM
  4. Sorting a filtered form
    By mikeal_a@yahoo.com in forum Forms
    Replies: 1
    Last Post: 07-26-2011, 08:30 AM
  5. Sorting in a form
    By PaulDouglas in forum Forms
    Replies: 3
    Last Post: 07-27-2006, 08:28 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