Results 1 to 7 of 7
  1. #1
    wackywoo105 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    34

    Reversing rowsource order for a multicolumn listbox

    I have a 3 column list box in the format:



    A1 A2 A3

    B1 B2 B3
    C1 C2 C3

    The rowsource for this contains A1;A2;A3;B1;B2;B3;C1;C2;C3

    I want to reverse the order so I have

    C1 C2 C3
    B1 B2 B3
    A1 A2 A3

    Which would give a row source of C1;C2;C3;B1;B2;B3;A1;A2;A3

    Does anyone have a piece of VBA code that would manage this?

  2. #2
    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,725
    Can you tell us more about Why you need this?
    Can you not just type it i?

  3. #3
    wackywoo105 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    34
    The listbox contains a filename, date and description in each of the 3 columns. I do not know what it will contain until some other VBA code populates it. The number of rows also varies. Currently the newest file is shown at the bottom but I want it reversed so it is shown at the top.

    How do I reverse the rowsource property in the maner described?

  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,725
    Normally the rowsource would be a query (SQL statement), and to reverse it you would change the ORDER BY clause.

  5. #5
    wackywoo105 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    34
    The listbox is populated using additem so there is nothing to order until after this has happened.

    All I then have to work with is the rowsource. There must be a simple way to rebuild it in reverse but jumping 3 ";" at a time.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    I think the code will have to add the rows to the list in the order you want. Where are these values coming from?
    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.

  7. #7
    wackywoo105 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    34
    Having slept on it I have figured out how to build the rowsource as a string in reverse instead of using additem. I don't know why I was struggling to come up with this.

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

Similar Threads

  1. Updating listbox rowsource not working
    By j2curtis64 in forum Forms
    Replies: 13
    Last Post: 12-07-2011, 01:46 PM
  2. Replies: 3
    Last Post: 10-01-2011, 02:21 PM
  3. ListBox RowSource Update Not working in 2003
    By Access0307 in forum Programming
    Replies: 1
    Last Post: 05-05-2011, 07:41 PM
  4. Reversing Conversion from Access 07 to Access 2000
    By ottawaroderick in forum Access
    Replies: 5
    Last Post: 03-16-2011, 10:33 AM
  5. SQL Rowsource
    By DSTR3 in forum Queries
    Replies: 2
    Last Post: 12-06-2010, 11:06 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