Results 1 to 10 of 10
  1. #1
    trock12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    4

    Return values from Previous Day

    Maybe there is a simple answer, maybe there is not. I have 2 user groups, 1 enters "incoming volume", 1 enters "outgoing volume" both on forms with a hardcoded "input date" for the date they are entering. For the sake of my example, lets call Incoming Volume = X, Outgoing Volume = Y and the Difference = Z.

    I have a report from queries created that takes this information as of today's date. So it would show for example X = 300, Y = 250, Z =50 with a date of 1/14/2016. Is there an easy way to duplicate this report to make one for yesterday (aka Today -1), 2 days ago, 3 days ago, etc. so that way it can show the trend of X, Y, Z for the past 5 business days?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Easy to produce a report filtered to a particular day. But if you want all 5 days side-by-side ... easy? - I doubt it.

    Maybe 5 subreports.

    Maybe 5 queries then join those queries.

    Maybe CROSSTAB query. http://allenbrowne.com/ser-67.html

    Maybe a query that emulates a CROSSTAB. http://datapigtechnologies.com/flashfiles/crosstab.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
    JamesDeckert is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Don't duplicate the report 4 more times. Find a way of using the same report to change the X & Y values.
    Does the user select which of the 5 reports to run, or do all 5 run every time?
    The query can reference a loaded form value so code can be used to kick off the report based on a query, then change the value in the form and kick off a new report.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    In general you could make a function that selects the values from a specific date relative to today. Today is Date in Access. So yesterday would be Date - 1...
    But it really depends on details of what you are trying to accomplish. A little more info would help readers.

  5. #5
    trock12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    4
    The picture is what I'm trying to do. Click image for larger version. 

Name:	expic.png 
Views:	19 
Size:	8.8 KB 
ID:	23421

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Options in post 2 still apply.
    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.

  7. #7
    trock12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    4
    Quote Originally Posted by June7 View Post
    Options in post 2 still apply.
    Thanks June7. The crosstab query works for pulling the X and Y values. The issue I'm having is the Z value isn't stored anywhere. It's strictly a formula being returned using the current information. As X/Y change, then Z changes but isn't actively stored. I guess if I knew how to store it as a value for a particular date that would work. Where somehow, daily, I run a report or form where it will auto-calculate Z and then store that info in a table to be able to query at a later time. Not sure exactly how to accomplish that option, either.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Saving calculated data is usually a bad idea, especially aggregate data. And saving aggregate data requires VBA. Review http://allenbrowne.com/AppInventory.html

    Why would you need to store the Z value? Just calculate when needed.
    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.

  9. #9
    trock12 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    4
    "Z" in my situation is "outstanding items". Was looking to calculate and store the Z value for the ability to do future trend analysis of volume/work required.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Queries should be able to produce the calculated data you need for analysis. No need to save to table.
    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. Replies: 8
    Last Post: 11-04-2015, 11:38 AM
  2. Replies: 7
    Last Post: 01-12-2015, 03:47 PM
  3. Recall previous values on a form
    By Thermalmonster in forum Programming
    Replies: 12
    Last Post: 07-28-2014, 01:54 PM
  4. Replies: 4
    Last Post: 03-16-2013, 08:31 AM
  5. Replies: 1
    Last Post: 03-27-2010, 06:13 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