Results 1 to 3 of 3
  1. #1
    jbuckner72 is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    12

    Mark each month between two dates

    I am trying to write a query to have a result that indicates the months a project was active. I know how to get my start month and end month as numbers. I am struggling to figure out all the months in between.



    Table: Projects
    Desc Live_Date Duration_Months
    Project A 8/15/2020 4
    Project B 6/12/2020 2


    From the example above, here is the output of the query I want
    Project Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    Project A X X X X
    Project B X X

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if your data table is designed correctly as:
    Project, month,Marked

    update table set marked = X where month between 5/1/19 and 8/1/19

    then run the crosstab query to show your data above.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    If you are not able to redesign Projects table, options:

    1. create a temp table and use VBA to populate with records, use that table as source for CROSSTAB

    2. review https://www.accessforums.net/showthread.php?t=18459
    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.

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

Similar Threads

  1. Trying to Select Dates by Month and Year
    By matechik4 in forum Queries
    Replies: 2
    Last Post: 07-22-2016, 06:56 AM
  2. Filter all dates within current month
    By wanderanwills in forum Access
    Replies: 3
    Last Post: 03-22-2015, 12:03 AM
  3. Replies: 8
    Last Post: 01-29-2014, 12:56 PM
  4. Showing dates in current month only
    By fistja in forum Queries
    Replies: 2
    Last Post: 04-09-2012, 10:17 AM
  5. Replies: 1
    Last Post: 03-02-2012, 11:09 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