Running sum in a form

  • Thread starter Thread starter Guest
  • Start date Start date
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!!
 
TT,

If UniqueField is a number...
=DSum("[Amount]","Query1","[UniqueField] <=" & [UniqueField])
If UniqueField is text...
=DSum("[Amount]","Query1","[UniqueField] <='" & [UniqueField] & "'")
 
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!!
 
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!!
 
Back
Top