Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Combo Box Order (2003 / 2000)

    i have a combo box in my form header that selects a record. However, I would like the record list to be in descending order number order. The row source for the combo box is shown below, but when selecting the combo box it always comes out in ascending order. What am I doing wrong?

    SELECT qryOrders.OrderID, qryOrders.[Order#], qryOrders.Company FROM qryOrders ORDER BY qryOrders.[Order#] DESC;

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Combo Box Order (2003 / 2000)

    Your SQL looks OK to me. If you switch from SQL view to datasheet view what order are the records in?

    I noticed in an earlier post that you mentioned changing Order# to a text field.
    Are the Order Numbers text values that look like numbers?
    Regards
    John



  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Box Order (2003 / 2000)

    Hi John,

    Well, that's weird! The data sheet view shows the order numbers in proper descending order. However, when I open the form and click on the combo box the order numbers are in ascending order. I thought perhaps it would work if I didn't specify the order in the combo box row source and let it use the underlying query for the entire form which is in descending order number order. However, no matter what I do, the combo box insists on displaying the ascending order!

    Yes, I did change the Order# field to text because the client uses leading zeros in his order number.

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

    Re: Combo Box Order (2003 / 2000)

    Do you have code that changes the RowSource of the combo box depending on some choice by the user?

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Combo Box Order (2003 / 2000)

    I don't know what to suggest.

    The order of records in the combo box has nothing to do with the order of records in the form , so the row source of the combo must specify the order you want.
    Just to test what is going on can you change the order of the combo to something completely different using its row source?
    Regards
    John



  6. #6
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo Box Order (2003 / 2000)

    You nailed it Hans,

    Although the underlying query for the form was in descending Order# order, an "on load" event for the form executes a "set row source" command based on an argument passed from the calling form. I added "DESC" to the "set row source" SQL statements and that solved theproblem. Obviously the row source for the form was overriding the row source for the combo box.

Posting Permissions

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