Results 1 to 5 of 5
  1. #1
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100

    How to return quarter and year for field?

    Hello - I have the expression below that I almost have working. It should return 4Qtr2021 for December 2021 but it returns 5Qtr2021. The expression only does that for December, all other months come up correctly.



    Code:
    (((Month(([Date])-1\3)+1) & "Qtr" & Year([Date]))
    Any ideas of what I missed?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    think your brackets are in the wrong place, try

    (Month([Date])-1)\3+1 & "Qtr" & Year([Date])

    note Date is a bad name for a field - it is a reserved word (it is a function that returns todays date). Change to something more meaningful like invDate, startDate, whatever

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Date is a reserved word and advise not to use reserved words as names.
    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
    MsAxes is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    100
    That did it - yes the field is named differently, just typed Date without thinking.

    Thanks for your help

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

Similar Threads

  1. Replies: 3
    Last Post: 07-28-2016, 10:44 AM
  2. Input Quarter-of-year on a Form
    By J4X in forum Forms
    Replies: 3
    Last Post: 12-09-2015, 11:41 AM
  3. Replies: 2
    Last Post: 06-21-2013, 12:28 PM
  4. Replies: 4
    Last Post: 01-09-2013, 11:16 AM
  5. Show Year with Quarter
    By Mordred in forum Access
    Replies: 9
    Last Post: 06-30-2011, 07:50 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