how to format combo box date type to show only they year value? RRS feed

  • Question

  • hi All

    if I have a combo box called cboYear , which get its value from table contains date dd-mm-yyyy format .

    1- I want this combo box to show only the Year value and eliminate the month and date.

    2- eliminate the duplicated years and show only the unique years.


    Saturday, April 30, 2016 8:43 AM


  • Let's say the table is named tblData and the field is named dtmDate.

    You can set the Row Source of the combo box to

    SELECT DISTINCT Year([dtmDate]) FROM [tblData]

    Year([dtmDate]) will extract the year from the date field, and DISTINCT makes the query show only unique values.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Siyamand Saturday, April 30, 2016 12:31 PM
    Saturday, April 30, 2016 9:24 AM

All replies