Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Allen Brown's - FindAsUType - combo box order

    I've been using this module for a while now, It's great. I'm sure I read the answer to this question a few days ago but I'm unable to find it again.

    I was wondering if anyone would know how to change the order of the combo box results. The combo box will pull the name of the label associated with textboxes on the form. Its name is cboFindAsUTypeField.

    I can post the code if someone wants a closer look, I'm just wondering if anyone knows off the top of their head.



    Thanks, Andy

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    its the sort of the query the box uses.

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I thought that, But the form is based on a table. The first field in this table is company name. Then in the combo box postcode appears first.

    I can try converting to a query and see if it makes a difference. It seems the combo box list of names is generated only based on form controls.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    the combo should be based on a query. The form can stay as a table. But Queries are better.

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Sorry I wasn't very clear. The Combo box has no record source at all. Allen Brown's - FindAsUType code generates this list. you just drop on the combo box and it does the rest.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    If I understand this utility correctly: the code builds a ValueList type RowSource for the combobox. User selects item that represents a field from the combobox and types parameter into textbox. Form is filtered accordingly with each keystroke in the textbox.

    I built something similar to this. I set up a combobox with static ValueList type RowSource. The list represents fields but not the exact field names because they are not 'user friendly' (Allen pulls the caption from associated label). Then I have a second combobox where code sets the Table/Query type RowSource according to selected field. However, code does not filter with each keystroke in the second combobox. These two controls are part of a group of controls used to filter form with multiple criteria, more like Allan's search form example.

    If you don't like the order of the fields listed in the combobox as dynamically built by the code, suggest you don't use that function and instead set the combobox with a static list.

    If you want to retain the function to dynamically build RowSource and you want alphabetical order, would need more code using arrays or collections: https://www.thespreadsheetguru.com/t...vba-array-list
    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
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    I'm sure I seen a few days ago someone doing this, can't see it again. I appreciate the replies anyway. People will have to select the filter they want!

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: 21
    Last Post: 04-29-2015, 11:57 PM
  3. Replies: 3
    Last Post: 01-04-2015, 06:09 PM
  4. Filter to a date range ala Allen Brown
    By kekawaka in forum Forms
    Replies: 2
    Last Post: 10-10-2011, 12:19 PM
  5. Combo Box in Alphabetical order
    By jordanturner in forum Forms
    Replies: 2
    Last Post: 09-24-2010, 08:02 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