Running sum in a form

G

Guest

Hi there,

I have a sub form on a form that is pulling data from a query. I want to
have a running sum on this subform (which is a continuous form) and used the
formula below. The record source for the subform is Query1.

=DSum("[Amount]","[Query1]","[UniqueField] <=" & "[UniqueField]")

I'm getting the sum of the entire query for each record and I'm not sure
what is wrong with my syntax.

Could someone help me out?

Thanks in advance!!
 
S

Steve Schapel

TT,

If UniqueField is a number...
=DSum("[Amount]","Query1","[UniqueField] <=" & [UniqueField])
If UniqueField is text...
=DSum("[Amount]","Query1","[UniqueField] <='" & [UniqueField] & "'")
 
G

Guest

Thanks Steve!

I appriciate the help. I should have mentioned that [UniqueField] was a
text value.

I've tried your suggestion and now it appears that the textbox holding my
DSum formula is now showing all fields as blank or null.

Now I'm really stumpped. Sorry to be a bother, but if you have any
suggestions, please let me know!

Thanks again!
Todd

Steve Schapel said:
TT,

If UniqueField is a number...
=DSum("[Amount]","Query1","[UniqueField] <=" & [UniqueField])
If UniqueField is text...
=DSum("[Amount]","Query1","[UniqueField] <='" & [UniqueField] & "'")

--
Steve Schapel, Microsoft Access MVP

Hi there,

I have a sub form on a form that is pulling data from a query. I want to
have a running sum on this subform (which is a continuous form) and used the
formula below. The record source for the subform is Query1.

=DSum("[Amount]","[Query1]","[UniqueField] <=" & "[UniqueField]")

I'm getting the sum of the entire query for each record and I'm not sure
what is wrong with my syntax.

Could someone help me out?

Thanks in advance!!
 
G

Guest

Sorry Steve,

Forget that last comment. I've figured out my problem and everything works
wonderfully!!

Thanks for your time!!

Todd

TT said:
Thanks Steve!

I appriciate the help. I should have mentioned that [UniqueField] was a
text value.

I've tried your suggestion and now it appears that the textbox holding my
DSum formula is now showing all fields as blank or null.

Now I'm really stumpped. Sorry to be a bother, but if you have any
suggestions, please let me know!

Thanks again!
Todd

Steve Schapel said:
TT,

If UniqueField is a number...
=DSum("[Amount]","Query1","[UniqueField] <=" & [UniqueField])
If UniqueField is text...
=DSum("[Amount]","Query1","[UniqueField] <='" & [UniqueField] & "'")

--
Steve Schapel, Microsoft Access MVP

Hi there,

I have a sub form on a form that is pulling data from a query. I want to
have a running sum on this subform (which is a continuous form) and used the
formula below. The record source for the subform is Query1.

=DSum("[Amount]","[Query1]","[UniqueField] <=" & "[UniqueField]")

I'm getting the sum of the entire query for each record and I'm not sure
what is wrong with my syntax.

Could someone help me out?

Thanks in advance!!
 

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