Results 1 to 3 of 3
  1. #1
    danassef is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    1

    Last week's data

    I'm trying to retrive my data from last week. As you know last week contains four days from the year 2014 and the other three occured in 2015. When I run my query I get only the data from 2015 and none of my data from 2014. I have an expression in my query of:



    Year(date())*53+DatePart("ww",Date())-1

    I run this query once a week on Monday or Tuesday and prior to the change in the year it worked just fine and gave me the data I need from the previous week, but now with the change in the year it is not giving all my data. How can I write this express to include the data from the previous week even if there is a change in the year?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    You want data for an entire week regardless of what period (month, year) the days are in? Only way I know is to calculate the date for first day of week a given date falls in and use that date for filter parameter.

    Review https://www.accessforums.net/access/...eek-42413.html
    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
    trevor40's Avatar
    trevor40 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    407
    You want data for an entire week regardless of what period (month, year) the days are in? Only way I know is to calculate the date for first day of week a given date falls in and use that date for filter parameter.

    can't you just use date()-7 ?
    gives the date for 7 days ago.
    based on you using date() as a reference for the start date, change it to whatever then " -7 " gives the start date less 7 days for that period.

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

Similar Threads

  1. querying data Grouped BY WEEK
    By scorpion99 in forum Queries
    Replies: 2
    Last Post: 12-16-2013, 02:31 PM
  2. Replies: 3
    Last Post: 09-19-2013, 10:18 AM
  3. Start a report on week 40 of a week count
    By aspitalnick in forum Reports
    Replies: 8
    Last Post: 11-28-2012, 04:53 PM
  4. Data group by week
    By hoachen in forum Access
    Replies: 2
    Last Post: 09-09-2011, 08:37 AM
  5. DSum where data is from previous week only
    By doodles in forum Access
    Replies: 3
    Last Post: 01-31-2011, 08:35 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