Results 1 to 7 of 7
  1. #1
    vickster3659 is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    47

    Month and Year criteria

    Hello,
    My crosstab query is using: Expr1: Format([DateDue],"mmm"). I would like to show the year as well. How would I do this, please?


    Thank you

  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
    53,648
    Try:

    Format([DateDue], "YYYYmmm")
    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
    vickster3659 is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    47
    Hi June7,
    This did not work for me. I am using Access 2002, however, not sure if it would be different.
    Thanks,

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    What does 'did not work' mean, what happens - error message, wrong results, nothing?

    Post the query SQL statement for analysis.

    Shouldn't make any difference.
    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.

  5. #5
    vickster3659 is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    47
    Sorry.....no data will show.

    Here is the SQL:

    TRANSFORM Count(qryCountPaymentsByBank.Amount) AS CountOfAmount
    SELECT qryCountPaymentsByBank.BankID, qryCountPaymentsByBank.TransactionCode, Sum(qryCountPaymentsByBank.Amount) AS [Total Of Amount]
    FROM qryCountPaymentsByBank
    GROUP BY qryCountPaymentsByBank.BankID, qryCountPaymentsByBank.TransactionCode
    ORDER BY qryCountPaymentsByBank.BankID, qryCountPaymentsByBank.TransactionCode
    PIVOT Format([DateDue],"YYYYmmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec");

    My Crosstab query is based on a Select query, with the date formatted as mm/dd/yyyy

    Thank you

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    I expect the issue is with the In clause. Try without it. How many years are in the database? The result should be field for each yyyymmm combination. Are you sure you want that?
    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.

  7. #7
    vickster3659 is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    47
    Hi June7,
    I took out the In clause, this gave me the expected results. I have 2 years, so far. I see why you asked if I really want this, since as time passes, this will become a rather large report very quickly, not conducive to printing. Therefore, I was able to make YYYY as a row header, which will make the report easier to print.
    Thanks for your help!

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

Similar Threads

  1. age and day - month - year
    By azhar2006 in forum Access
    Replies: 4
    Last Post: 08-21-2014, 08:30 AM
  2. Replies: 4
    Last Post: 05-26-2013, 03:28 PM
  3. Parameter with Month & Year Criteria
    By Huddle in forum Access
    Replies: 3
    Last Post: 10-24-2012, 01:20 PM
  4. default month and year
    By beefyalby in forum Forms
    Replies: 3
    Last Post: 12-05-2010, 11:40 PM
  5. by year by month
    By nkuebelbeck in forum Reports
    Replies: 21
    Last Post: 03-24-2010, 01:53 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