Results 1 to 7 of 7
  1. #1
    wcook101 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    56

    How do i sort a combo box when finding a record on a form?


    I have a database of parts and some parts have the same part number but different manufacturers. I set up a simple combo box to search the 20k records and it works fine to a point. I noticed when i typed in LM324N that it didn't sort the parts at all and about 5 rows down i see another LM324N.
    How can i sort so it shows all the parts of different manufacturers?
    Thanks

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Assuming the combo box is based on a query then sort it in that query

  3. #3
    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,722
    What is the rowsource of the combo?

    You'd have a query along this set up (but we need more info/details)

    SELECT Parts.* from Parts
    Where Parts.[Part Number] = YourComboBox
    ORDER BY Parts.[Part Number]

  4. #4
    wcook101 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    56
    I just did this, and now it works fine
    SELECT [STOCK].[ID], [STOCK].[PartNumber], [STOCK].[MFR], [STOCK].[QOH] FROM STOCK ORDER BY PartNumber;

    Im just curious why the combo box wizard doesn't ask if you had any sort order in mind.

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    I've never noticed that when creating a combo to find a record. It certainly gives sort options for other type of combo 🙂

  6. #6
    wcook101 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    56
    Right, I know. Its pretty weird. I thought maybe I was doing something wrong. I couldn't understand why there was no sort option. I definitely think MS missed this one.

  7. #7
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    I have a database of parts and some parts have the same part number but different manufacturers. I set up a simple combo box to search the 20k records and it works fine to a point.
    ...
    How can i sort so it shows all the parts of different manufacturers?
    ...
    I just did this, and now it works fine
    SELECT [STOCK].[ID], [STOCK].[PartNumber], [STOCK].[MFR], [STOCK].[QOH] FROM STOCK ORDER BY PartNumber;
    And if you want to finetune so that all the part numbers that are the same are also secondarily sorted by manufacturer than perhaps add the extra field at the end of the SQL statement:
    SELECT [STOCK].[ID], [STOCK].[PartNumber], [STOCK].[MFR], [STOCK].[QOH] FROM STOCK ORDER BY PartNumber, MFR;

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

Similar Threads

  1. Replies: 25
    Last Post: 02-22-2018, 02:23 PM
  2. Replies: 7
    Last Post: 07-20-2015, 02:17 AM
  3. Replies: 5
    Last Post: 04-24-2014, 10:02 AM
  4. Combo Box Not finding Records on Form
    By sivega in forum Forms
    Replies: 3
    Last Post: 06-15-2013, 10:25 AM
  5. finding last record in a table/form
    By clue74 in forum Access
    Replies: 3
    Last Post: 07-19-2012, 06:46 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