Results 1 to 5 of 5
  1. #1
    clarkproperties is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2020
    Posts
    7

    Date in access

    How do you change the year 2020 to current year



    TRANSFORM Sum(CCur([Order Details].[UnitPrice]*[Quantity]/100)*100) AS ProductAmount
    SELECT Products.ProductName, Orders.CustomerID, Year([OrderDate]) AS OrderYear
    FROM Products INNER JOIN (Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
    WHERE (((Orders.OrderDate) Between #1/1/2020# And #12/31/2020#))
    GROUP BY Products.ProductName, Orders.CustomerID, Year([OrderDate])
    PIVOT "Qtr " & DatePart("q",[OrderDate],1,0) In ("Qtr 1","Qtr 2","Qtr 3","Qtr 4");

    Thanks in advance

    Steve

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Try:
    WHERE (((Orders.OrderDate) Between #1/1/Year(Date)
    # And #12/31/Year(Date()#))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,944
    Quote Originally Posted by Bob Fitz View Post
    Try:
    WHERE (((Orders.OrderDate) Between #1/1/Year(Date)
    # And #12/31/Year(Date()#))
    Bob, wouldn't we need & in there?

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    alternatively

    WHERE Year(Orders.OrderDate)=Year(Date())

  5. #5
    clarkproperties is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2020
    Posts
    7
    thank you all i got it

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

Similar Threads

  1. Replies: 5
    Last Post: 12-09-2019, 05:33 PM
  2. Replies: 2
    Last Post: 09-29-2019, 09:36 PM
  3. Replies: 5
    Last Post: 08-15-2019, 03:46 PM
  4. Replies: 2
    Last Post: 10-11-2017, 09:33 PM
  5. Replies: 12
    Last Post: 04-26-2012, 04:01 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