Results 1 to 4 of 4
  1. #1
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26

    Rolling 12 months in a combo box in access

    Do you know how to code the rolling 12 months in a combo box?


    (1) When I click on the combo box this month, the first value should be 2015-07 (yyyy-mm) and the last one should be 2016-06
    (2) When I click on the combo box next month, the first value should be 2015-08 (yyyy-mm) and the last one should be 2016-07.



    The combo box will check today's month and will automatically generate the 12 rolling months (include this month).



    Please give me some ideas.

    Thanks.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    You are going to have to show us some code or screen captures to show us what you are talking about. The post is too vague at the moment without some reference specific to your materials.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Unless you have a table that can serve as the source, requires VBA code to build the combobox RowSource. In form Open event, something like:

    For x = 0 to 11
    Me.comboboxname.AddItem Item:=Format(DateAdd("m", x, Date), "yyyy-mm"), Index:=0
    Next

    https://msdn.microsoft.com/en-us/lib...or=-2147217396
    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.

  4. #4
    kacocal is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    26
    Thank you very much.

    Quote Originally Posted by June7 View Post
    Unless you have a table that can serve as the source, requires VBA code to build the combobox RowSource. In form Open event, something like:

    For x = 0 to 11
    Me.comboboxname.AddItem Item:=Format(DateAdd("m", x, Date), "yyyy-mm"), Index:=0
    Next

    https://msdn.microsoft.com/en-us/lib...or=-2147217396

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

Similar Threads

  1. Calculate YTD and Rolling-12 Months Totals?
    By McArthurGDM in forum Access
    Replies: 7
    Last Post: 04-08-2015, 11:37 AM
  2. VBA - 13 month rolling data with missing months
    By tbelly82@gmail.com in forum Programming
    Replies: 2
    Last Post: 06-02-2014, 06:27 AM
  3. Replies: 2
    Last Post: 04-29-2014, 03:04 AM
  4. Replies: 3
    Last Post: 02-23-2014, 02:06 PM
  5. Rolling Months within a Report
    By RayMilhon in forum Reports
    Replies: 5
    Last Post: 06-14-2013, 03:28 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