Results 1 to 5 of 5
  1. #1
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60

    Query to show data up to end of month before

    Please can you help - I run a query each month to show our sales figures.

    Is there a way I can automatically get the query to show data up to the end of the month before; either that or prompt for an 'end' date only.

    I've tried 'dateserial' but not having any luck.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Try month(Saledate) <= month(date)-1

    using your own field name for the sales date. If you only last month's data, just change <= to = .

  3. #3
    Pure Salt is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Apr 2014
    Posts
    60
    Thank you John

  4. #4
    Join Date
    Apr 2017
    Posts
    1,673
    Quote Originally Posted by John_G View Post
    Try month(Saledate) <= month(date)-1
    And what happens in January? Or with dates in December 2 years ago?

    How about SaleDate < DateSerial(Year(Date),Month(Date),1)

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    And what happens in January? Or with dates in December 2 years ago?
    My Bad! Thanks for pointing that out. Too early in the morning, I guess.

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

Similar Threads

  1. Making Month Names show in query reports
    By jdboss53 in forum Queries
    Replies: 7
    Last Post: 01-04-2017, 05:18 PM
  2. Replies: 2
    Last Post: 02-12-2015, 05:14 AM
  3. Replies: 1
    Last Post: 03-29-2014, 10:19 AM
  4. Replies: 10
    Last Post: 10-19-2012, 05:10 AM
  5. Query to show averages by month
    By DDEB in forum Queries
    Replies: 3
    Last Post: 05-08-2012, 05:11 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