Results 1 to 6 of 6
  1. #1
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7

    Table has multiple years but want combobox to show only one

    Hi,

    I have a table that has many records that show the same year. For example

    2011
    2011
    2011
    2012
    2012
    2012


    ...etc

    In one of my forms, I want the user to be able to select a year, BUT I only want to show the years shown in my table. Upon selecting the year, it would open a report showing ONLY that year.

    I can't figure out how to make my combo box show only 2011 or 2012 or 2013 once instead of showing EVERY record in my table

    Pleeeeaaasssseee help!

    Thanks,
    Tron

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    I think you need to add a "Group By" clause to the SQL statement in the Row Source property of the combo box.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    add DISTINCT to the SQL of your rowsource,:

    SELECT DISTINCT [fieldname] from [tablename] order by [fieldname]

  4. #4
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7
    Tried the "Group By" In the SQL Statement under Criteria and still I get an error message "Data type mismatch in criteria expression"

  5. #5
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7
    NoellaG, I tried the "DISTINCT" to the rowsource. It seems all my years disappear and I can't select anything from the combo box.

  6. #6
    Tron142 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jul 2011
    Posts
    7
    nvm, it worked like a charm! Thanks so much!

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

Similar Threads

  1. Populating 10+ Years of Dates Table
    By Mordred in forum Access
    Replies: 2
    Last Post: 04-27-2011, 06:40 PM
  2. Combobox to show two field values
    By lnordstrom in forum Forms
    Replies: 2
    Last Post: 03-30-2011, 12:33 PM
  3. Show data not in table A using multiple fields
    By mikesmith01 in forum Access
    Replies: 3
    Last Post: 02-25-2011, 08:38 AM
  4. Query Multiple years
    By sammer021486 in forum Queries
    Replies: 3
    Last Post: 10-21-2009, 02:13 PM
  5. Replies: 1
    Last Post: 03-15-2007, 03:38 PM

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