Results 1 to 4 of 4
  1. #1
    Remillard is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Kelowna, British Columba
    Posts
    14

    Combo Box, "ALL" value

    Noob user with a noob question.
    Briefly, my table tracks Staff and a lot of information about them, one of which is which "Site", whose value can be 1 of 3 choices, I'll call them "Site1", "Site2", and "Site3".
    I have a form used to pass values to a query, to find records based on which Site the staff works at and on another field; we'll call it "InsuranceExpiryDate".
    I have a Combo Box on the form, called "Site" which I have populated myself with, "Site1", "Site2", "Site3" and I want to have an option for "ALL" so the query can find everyone in a particular Site whose insurance is expired or just everyone in the db whose insurance is expired.


    I'm building this db for users who are not Access literate at all so I only want them to be able to choose a site or "all" from the drop down, and a date from a date field calendar.
    So, long story short, how does one do "ALL" in a combo box?

    Cheers!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Remillard is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Kelowna, British Columba
    Posts
    14
    Thanks for the links. I ran into Union queries in my searching for an answer but was hoping for just adding something to a value list. In the first link it looks like the second option fits my needs better but there is a cautionary in the info:

    ---------
    "One requires the use of an Union query, and the other one requires a callback function to fill the control. Generally using an Union query is easier. Callback functions are important in certain cases, but perhaps an overkill in this situation."
    ---------

    Not sure what a Callback function is or why it's overkill. This is the function. I'm just unclear where the code goes.

    ---------
    If the RowSourceType is set to "Value List", you can simply concatenate "(All)" as the first choice when the form opens. So if the RowSource of the control Combo0 is
    "Hello"; "World"
    Then this code will change it to
    "(All)";"Hello"; "World"
    '******* Code Start ********
    Private Sub Form_Open(Cancel As Integer)
    With Me.Combo0
    .RowSourceType = "Value List"
    .RowSource = "(All);" & .RowSource
    End With
    End Sub
    '******* Code End ********

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Based on the first line of the code, it goes in the open event of the form. Personally I virtually always use a table rather than a value list. Seems more dynamic and maintainable to me.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 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