Total on a Form (1 Viewer)

mjwillyone

Registered User.
Local time
Today, 00:45
Joined
Aug 3, 2004
Messages
27
Friends,

I have a table that contains pledges to various causes. Here is a sample of the fields I want to use and the type of info in each field:

PldgCode AmtPerGift
24 10.00
32 15.00
24 10.00

What I want to be able to do is put the number 24 in a field on the form, then on another field the value of $20 would show up (the sum of the two pledges in the amount of $10 each to project number 24.) Is there a way I can do this?? I wouldn't mind using a query that, say, is started when I click a button it looks at the field where I put the pledge code and then puts the $20 amount in a field on the form. I do want to use the $20 amount in another calculation so this process should actually save the sum of the pledges to a field.

Any help you can give would be most appreciated.
 

RuralGuy

AWF VIP
Local time
Yesterday, 23:45
Joined
Jul 2, 2005
Messages
13,826
You should be able to use the DSum() function to get what you want. VBA Help has a pretty good description on how to properly use the function.
 

KeithG

AWF VIP
Local time
Yesterday, 22:45
Joined
Mar 23, 2006
Messages
2,592
You can use the pldgCode controls after update event to refresh the totals pledges control. use the below expression for the total pledges control

=DSum("AmtPerGift","[TableName]","PldgCode='" & forms![FormName]![PledgeNumberControlName] & "'')
 

Users who are viewing this thread

Top Bottom