Results 1 to 4 of 4
  1. #1
    mejia.j88 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228

    Question Displaying Previous Week's Data in Subreport

    Hello all,

    I have a report in which the day's production is displayed.


    The report shows basic information involving yield according to shift, part number, etc etc.
    At the end of the report, I have a line that shows the overall yield of the day's production; in other words, it adds up the In quantities and the Out quantities and shows the percentage accepted of all parts.

    i would like to create a sort-of subreport in which I can show the overall yield for the previous week, the one before that, etc.

    ideally, i would want to show data for the last 5 weeks or so.

    I am not sure how to address this idea correctly, or how to set up a query(ies) that will allow me to structure what I want.

    Any ideas? please feel free to share.

    Thank you in advance,

    j

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    Sounds like a subreport with grouping of data by week. The query could be set up with a field that calculates week number based on a date field and then criteria would limit the records to those for the previous 5 weeks including the current week.
    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
    mejia.j88 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    hi june7,

    the part im having trouble with is setting up the field that calculates week number based on the date field.
    how would i set up the field so that it shows for five different days.

    right now i have a query (on paper, haven't made it yet) which would have a field called Week One with the criteria Between Date()-1 and Date()-8. Suppose the report is viewed today, then week one would show the data from between Yesterday 6/28 and 6/21, which would be one week.

    would i have to create 4 other different fields with similar formulas date-9 and date-16, date-17 and date-24 etc. ?

    or is there a way to have it work with one field only?

    thanks

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    Calculate week number with:

    Datepart("ww",date) will return week of year
    Datepart("w",date) will return week of month

    So in query:
    SELECT *, Datepart("ww",date) As WeekNum, Year(date) As Yr FROM tablename;

    Then criteria under WeekNum could be:
    >Datepart("ww",date)-5

    If data is multi-year, probably also want to include year criteria.
    Last edited by June7; 07-02-2012 at 12:43 AM.
    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.

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

Similar Threads

  1. Form with Subreport Displaying Wrong
    By claysea in forum Forms
    Replies: 3
    Last Post: 02-14-2012, 03:25 PM
  2. Replies: 1
    Last Post: 12-21-2011, 02:11 PM
  3. Replies: 5
    Last Post: 12-06-2011, 11:18 AM
  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

Tags for this Thread

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