Results 1 to 7 of 7
  1. #1
    Vaibhav2015 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    14

    how to add select all option in combo box

    Hi,


    I have created Form and added 2 two combo box. In that combo box I have multiple values, I want to select all value by selecting "Select All" option.
    can you please advice how I can add "Select All" option.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    that is not what a combo box is for. combo means pick 1 item (hence the nature)
    if you want to pick 1 to N, use a list box.
    (a hammer is for nails, a screwdriver is for screws)

  3. #3
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    make a union query for the row source of the combo box
    SELECT [tblTable].[field] FROM [tblTable] UNION SELECT 0, "(Select All)" FROM [tblTable]
    ORDER BY [tblTable].[field];

    Then in your VBA look for build a query to filter on and look for the 0, meaning "Select All" and build the query string appropriately.
    BTW: I'm assuming you're using these to filter data and they are unbound fields.

  4. #4
    Vaibhav2015 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    14
    Thanks James, I created union query as below mentioned and I can see list of plants in combo box. But I am not able to create query in VBA. can you please help me for VBA query.

    SELECT [plant2] FROM [ACT_Sub_table] UNION SELECT 0,"(Select All)" [Plant] FROM [Plant data ACT table];

  5. #5
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    try this
    SELECT [plant2ID], [plant2Desc] FROM [ACT_Sub_table] UNION SELECT 0,"(Select All)" FROM [
    ACT_Sub_table] ORDER BY [plant2Desc];
    I'm assuming you have a plant ID and a plant description with column 1 as your bound column. If not
    SELECT [plant2] FROM [ACT_Sub_table] UNION SELECT "(Select All)" FROM [ACT_Sub_table] ORDER BY [plant2]
    you added a second table, which I don't know what that was for.

  6. #6
    Vaibhav2015 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    14
    Hi,
    I used SELECT [plant2] FROM [ACT_Sub_table] UNION SELECT "(Select All)" FROM [ACT_Sub_table] ORDER BY [plant2]
    its working, but when I select all I got error message " The Value you entered isn't valid for this field".
    Plan column is Short text type.

    Please advice.


  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    As James stated earlier, controls used to enter/select filter criteria must be UNBOUND.

    Is the combobox ValidationRule set?
    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.

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

Similar Threads

  1. Using Option Box to Select Criteria
    By HelpDesk in forum Queries
    Replies: 1
    Last Post: 07-17-2015, 10:41 AM
  2. Replies: 4
    Last Post: 07-18-2014, 10:51 AM
  3. Combo Box Wizard does not have option form option
    By CementCarver in forum Forms
    Replies: 5
    Last Post: 02-28-2013, 08:54 PM
  4. Replies: 6
    Last Post: 12-30-2011, 08:09 PM
  5. Replies: 1
    Last Post: 05-05-2011, 09:21 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