Results 1 to 4 of 4
  1. #1
    derek7467 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    46

    Using an option group to sort by VBA

    Morning!

    I am using an option group to sort report fields. It works great how i currently have it setup. I would like to add a specific descending order to my Case 5, how would i add that?:

    With Me
    Select Case Frame26.Value
    Case 1
    'code to order by the CompanyName field
    .OrderBy = "ACD Calls"
    Case 2
    'code to order by the ContactName field
    .OrderBy = "Avg ACD"
    Case 3
    'code to order by the City and CompanyName fields
    .OrderBy = "Total ACW"
    Case 4
    'code to order by the City and CompanyName fields
    .OrderBy = "AHT"
    Case 5
    'code to order by the City and CompanyName fields
    .OrderBy = "AgentCPH"
    End Select
    .OrderByOn = True
    End With

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Doing this directly in the Properties Pane it would be

    "[AgentCPH] DESC"

    So I would try

    .OrderBy = "AgentCPH DESC"

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    derek7467 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    46
    thanks that worked.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Glad we could help!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Group by one field, sort by another
    By tylerg11 in forum Reports
    Replies: 4
    Last Post: 03-05-2013, 01:17 PM
  2. sort option button
    By turk in forum Access
    Replies: 9
    Last Post: 03-08-2012, 03:16 PM
  3. Option Group
    By x__hoE__x in forum Access
    Replies: 2
    Last Post: 12-10-2011, 09:39 AM
  4. Group Header and then a Sort
    By bbulla in forum Reports
    Replies: 1
    Last Post: 09-29-2011, 09:56 AM
  5. Option Group
    By huskies in forum Forms
    Replies: 9
    Last Post: 12-02-2009, 12:06 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