A little help with a calculated field

valley

Registered User.
Local time
Today, 13:20
Joined
Nov 17, 2006
Messages
34
Hello,
Can someone please help with this expression?

I have a table with text field Cust_ID and a
Number field MCounter.

I would like to put in an expression as source in a form
Text field based on the same table to AGGREGATE
all MCounter values for a Given Cust_ID

Something like
Sum(MCounter) where "Cust_ID"=[Cust_ID]

Is this a correct expression?

Many thanks for any help.
 
The SQL would look closer to:

"Select Cust_ID, Sum(MCounter) where Cust_ID = ' & [Cust_ID] & "' GROUP BY Cust_ID"

But if you are looking to have this be the source for a control on a form, then take a look at the DSUM function.
 
Many thanks for the reply.

However that gives me a #Name? error.

I have just this as source in another field in the Form
which works well to give the ALL total.
=Sum([MCNEWdisp]) where MCNEWdisp is a numeric
field in the table

I have tried DSum and have this as the Source Value

=DSum("MCcounter","Miracle_Cloth_Main"," Cust_ID = ' & [Cust_ID] &'")

This doesn't give any error but the field is coming as empty when there are
values for MCcounter in the Table.
 
Last edited:
Try this:

=DSum("MCcounter","Miracle_Cloth_Main","Cust_ID = '" & [Cust_ID] &"'")
 

Users who are viewing this thread

Back
Top Bottom