Summing Previous Two Records in a Report

  • Thread starter Thread starter Jaxamercy via AccessMonster.com
  • Start date Start date
J

Jaxamercy via AccessMonster.com

I have a report whithin which I need to create a control in a text box that
would sum the fields of the last to records in a table.

I am reporting product returns and those returns that have not been processed
in 48 hours so I have a table that looks similar to below:

InputDate No.Returns No.NotProcessed

01/09/06 1
0
02/09/06 2
0
03/09/06 1
1
04/09/06 1
0

I need to create something like an IF statement to say something like:

=IF(No.NotProcessed>0,sum(No.Returns"PREVIOUS 2 RECORDS")

So if I was investigating the 03/09/06 the result would be 3

Any help would be really appreciated
 
Jaxamercy:

To do this, you need to use a subquery in your report's query. To get an
idea how to do this, stop by our web site and look in the code & design tips
area under queries for the tip on creating an auto number query and the tip
on creating a running sum query. Each of these uses a subquery wherein the
underlying records have a definitive primary key and/or date which can be
spanned to pull in previous records in the table into the current return row
of the query. That should get you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top