DSum of a field Calculation? HELP

tafnuef1

Registered User.
Local time
Today, 06:36
Joined
Apr 22, 2010
Messages
43
Ok, how would I do this?

I have a Query (Prepper Error Table Query) that pulls this data:
BatchNumber ID
Prepper Error
Prepper Name
Prepper Doc type

I have a subreport (Error Counts) where I need to subtotal the total amount of errors per Batch Number ID

So In my report(Error Counts) I gathered the "Batch Number ID, "Prepper Error" and the "Prepper Name"

I am grouping it By Prepper Name, Batch Number ID and Prepper Errors

then I have a field Control that counts the number of Prepper Errors Per Batch Number ID PER Prepper Name.

So I could have this in my report

Prepper Name: Mickey Mouse
Batch Number ID: 99999999
Prepper Error....
Prepper Error.....
Prepper Error Count: 2
Batch Number ID: 88888888
Prepper Error....
Prepper Error.....
Prepper Error....
Prepper Error.....
Prepper Error Count: 4


So Now what I need in the "Prepper Name Footer is a total of all errors per "Prepper Name"? Do I do the DSum here?

I was thinking =DSum("[Prepper Error Count]", '[Error Counts]", "[Prepper Name]")

but this returns and Error# I am so new at the DSum process I am clueless. How should I do this?
 
Last edited:
A DSum() would not be my first alternative. Try this as the control source of a textbox in the prepper name footer:

=Count("*")
 
So in my below sample, where I am calculating the individual error count for a batch I then create another count in the footer that counts that contol box too? I have tried that before and not sure it works but I will try it again.

Example:
Prepper Name: Mickey Mouse
Batch Number ID: 99999999
Prepper Error....
Prepper Error.....
Prepper Error Count: 2 (lets say this control box is named Prep Error Count)
Batch Number ID: 88888888
Prepper Error....
Prepper Error.....
Prepper Error....
Prepper Error.....
Prepper Error Count: 4(Same as above "Prep Error Count")

So the box in the footer would be
=Count("Prep Error Count")

I will let you know if this works...
 
Actually once I started doing this I realized I need to SUM the Counts of Errors PER Batch.

So in the example above if Batch numb 999999 has 3 errors and Batch Number 8888 has 3 I want to sum up the total amount of errors for that PREPPER. I want to SUM it but of course Access won't let me Total a Calculation.... So I figured the DSum Expression would work.. But I have no clue how to do that?

Report name: Errors and Counts
Calculation Name: Count of Errors
Control Name where I want the Total of all Errors: Total Errors
Table I am retrieving Errors from: Prepper Error Table
Not sure what other information would be needed.

So Would I set it up as:
=DSum("[Count of Errors]", "[Prepper Error Table]", "[Errors and Counts]"
 
It would be nice to see the actual db, but again DSum() would be low on my list of solutions. Domain aggregate functions can really slow down a report. If you really want to use it, you have the criteria syntax wrong:

http://www.mvps.org/access/general/gen0018.htm

Generally you can move a calculation to the report's source query instead of in the report, which will allow you to Sum() it. You can also sum a calculation:

=Sum(Price * Quantity)
 

Users who are viewing this thread

Back
Top Bottom