Sum of a queryfield in a formfield

quacka

Registered User.
Local time
Today, 19:04
Joined
May 16, 2007
Messages
16
Hopefully a very simple question for you guys, but I don't know how to start.

I have a query (let's call it Query1)
3 fields: ID, Date and Amount.

In a form I want a field with the sum of Amount, for a choosen ID. (this choosen ID is already somewhere in the form: Textfield 'FormID').
Let call this field 'SumAmount'

ID - Date - Amount
A - 5/10/2008 - 50
A - 5/11/2008 - 60
B - 5/12/2008 - 40
(in reality 10-15 ID's with already 5000 records and increasing...)

When FormID = A, I want 'SumAmount' to be 110.
When FormID = B, I want 'SumAmount' to be 40.

I need to open the query as a recordset. But I don't know how to do it exactly.
Maybe someone can help me!
 
Just use this
dsum("Amount","Query1","ID='FormID'")
 

Users who are viewing this thread

Back
Top Bottom