Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Second filter with OrderBy (Access 2000)

    I want to carry out a second filter of my ListBox called ListCustomers with the command OrderBy of the sort:
    with the help of an additional control.
    The List box ListCustomers is already filtered by other criteria, and i want the result received
    to be arranged by Companyname.Something like :
    Me!ListCustomers ORDER BY Customers.CompanyName
    How an i proceed ?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Second filter with OrderBy (Access 2000)

    You have to rebuild the rowsource for the listbox. There is no Order By property for a listbox, so the only way to change the sort is by rebuilding the rowsource.
    Charlotte

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Second filter with OrderBy (Access 2000)

    To change the order of the items in a list box (or combo box), you must change the Row Source of the combo box. If the Row Source is a query, you can specify the sort order in the query; if it is an SQL statement, you can add the ORDER BY clause to it, for example

    Me!ListCustomers.RowSource = "SELECT ... FROM Customers WHERE ... ORDER BY Customers.CompanyName"

    (The ... must be filled in of course)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •