help with running sum

G

Guest

Hi all
I need your help with this

I have two form: expense reports by patient , expense reports
they are just like the sample database of microsoft"expense reports by
employee"

now , in the expense report form (which is not subform but a separate form
with same info as the patients subform) i want to add new fields like this:

there is one field in the main form "expense rep by patient" called "deposit"
which will show deposit amt paid to a hospital if any to treat a patient.

ok now , in the exp rpt form , i may recieve more than one invoice for this
patient,but i will not settle directly, first i have to see deposit amt, how
much of it we have utilised. i.e deposit is 50000
if first invoice is 10000 then , in the field "advance" in the exp rpt form
, i will put this amt.
next invoice suppose 500 same thing ,
but i want to add new field to show me the sum of all these .
( a field that will show me the total amt of invoice in the prev records
that has been enterd previously in the field "advance"(running sum)

so i reach third record i want it to till me that total amount "running sum"
of advance field for this patient is this much (10500), and the balance out
of the deposit is this much.

i have tried this as a control source but is not giving corrent figure
=DSum("[advance]","expense reports","[PATIENTID]")
 
D

Damon Heron

It seems like the criteria you are using for you dsum is PatientID. This
would return all of the records for all patients. You need to restrict the
patientId to the one you are working on. See Help for the DSum function (in
the vba code window, not the main access window).
Also, the rest isn't totally clear, but you want to subtract the 10500 from
50000 and display that, is that correct?
 

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

Top