Results 1 to 7 of 7
  1. #1
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    136

    Automatically order the items in a list box


    Is there a property that will automatically order the items in my list box in Ascending order?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    the query does the order.
    If you dont like the alphabetical order, add a 2nd column that is numeric and sort by that.

  3. #3
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    136
    It’s not doing it in my case.
    i have a table that gets populated.
    each time data is added to the table using insert into statement whilst preserving the existing data, it is not ordered despite putting an order by clause in the sql statement.
    consequently, my list box that gets its data from this table is unordered too which makes it hard for the user to select items from the list box.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Please show us a copy of the database or the vba code that interacts with the list box.

    For the listbox rowsource you could use something along these lines generally:

    Code:
    Select yourfld, yourfld2 from yourTable
    Order By yourfld2
    Ascending is the default Ordering.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    each time data is added to the table using insert into statement whilst preserving the existing data, it is not ordered despite putting an order by clause in the sql statement.
    For all intents and purposes, there is no such thing as a table order - at least when dealing with queries or recordsets. You seem to be saying that you expect the append query to perform some kind of sort. It will not. The query you need to impose a sort in is the query that populates the listbox, not the table.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    136
    Quote Originally Posted by orange View Post
    Please show us a copy of the database or the vba code that interacts with the list box.

    For the listbox rowsource you could use something along these lines generally:

    Code:
    Select yourfld, yourfld2 from yourTable
    Order By yourfld2
    Ascending is the default Ordering.
    Thanks orange, this is working now after your helpful input.

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

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

Similar Threads

  1. Replies: 2
    Last Post: 03-07-2016, 05:02 PM
  2. Replies: 2
    Last Post: 04-29-2015, 05:58 AM
  3. Replies: 7
    Last Post: 05-12-2012, 03:46 PM
  4. prefilling items into an order form
    By syscoandrew in forum Forms
    Replies: 5
    Last Post: 09-25-2011, 12:27 PM
  5. Replies: 2
    Last Post: 05-19-2011, 04:07 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