Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Unanswered: Adding a value to a combobox based on a query

    I have a combo box whose row source is currently a query. I would like to add a value to it ("None of the above") to the list of possible values such that no matter what the query returns, "None of the above" is one of the choices. Is there an easy way to do this?

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Replace your combobox RowSource with this

    Code:
    SELECT YourField FROM YourTable
    UNION SELECT "None of the above" FROM YourTable;
    filling in your actual field and table names for YourField and YourTable.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jun 2009
    Posts
    4
    Excellent! Thanks!

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Jun 2011
    Posts
    2

    GoodOne! thanks!

    GoodOne! thanks!
    But the only issue with it is "None of the above" is displayed at the bottom of the list and infact it makes sense
    but If I want to display similar value like 'ALL' at the top of the list,
    I am unable to use the query. If I reverse the SQL like mentioned below, I get an error

    SELECT "ALL" FROM YourTable UNION
    SELECT YourField FROM YourTable;

  6. #6
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    You can use an ORDER BY clause and add a trailer space to ALL (i.e. ' ALL") to be sure that it will be on the top line.
    Have a nice day!

  7. #7
    Join Date
    Jun 2011
    Posts
    2
    Thanks! Though not perfect, a good idea though!

Posting Permissions

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