Results 1 to 3 of 3
  1. #1
    ptenhet is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Posts
    2

    Dynamic Combo choices for years

    Wanted to add a drop down to pick rolling three years. How do you do that for the row source?



    Want last, current, and next year for the choices. Can you use formulas in the list?

    Datepart(yy,now())-1
    Datepart(yy,now())
    Datepart(yy,now())+1

    Thanks
    pt

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Apparently not, I just tried.

    Can use VBA to set the combobox RowSource property. The really trick is figuring out what event to put the code in. Try the form Load event.

    Me.comboboxname.RowSource = Year(Date())-1 & ";" & Year(Date()) & ";" & Year(Date())+1

    Have to set the combobox RowSourceType to ValueList.
    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.

  3. #3
    ptenhet is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2015
    Posts
    2
    Had to use this and worked perfect. Thank you

    Me.RecoverDate.RowSource = DatePart("yyyy", Now()) - 1 & ";" & DatePart("yyyy", Now()) + 1

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

Similar Threads

  1. dynamic combo boxes
    By brad in forum Forms
    Replies: 1
    Last Post: 04-15-2013, 01:07 PM
  2. Dynamic combo box
    By Accessuser67 in forum Forms
    Replies: 6
    Last Post: 01-10-2013, 03:23 PM
  3. Replies: 3
    Last Post: 08-19-2011, 09:25 AM
  4. Replies: 1
    Last Post: 05-25-2011, 08:37 AM
  5. Query to Limit Combo Box Choices
    By jimrockford in forum Queries
    Replies: 2
    Last Post: 04-23-2011, 10:24 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