DSum

  • Thread starter Thread starter sljack63
  • Start date Start date
S

sljack63

I want to calculate a running sum in an unbound control on my form. I
want it to total the field [TitlePoint] from table [tblAgilityRec] up
to the date that appears in the field [AGDate] on my form. Here is
what I've tried so far, but I get a #Name error:

=DSum([TitlePoint],[tblAgilityRec],[tblAgilityRec]![AGDate]<=[AGDate])
 
I want to calculate a running sum in an unbound control on my form. I
want it to total the field [TitlePoint] from table [tblAgilityRec] up
to the date that appears in the field [AGDate] on my form. Here is
what I've tried so far, but I get a #Name error:

=DSum([TitlePoint],[tblAgilityRec],[tblAgilityRec]![AGDate]<=[AGDate])

The domain aggregate functions (such as DSum) take string arguments:

=DSum("TitlePoint", "tblAgilityRec",
"AGDate<=" & Format([AGDate], "\#mm/dd/yyyy\#"))

Note that the above approach formats the value of the AGDate control as
a date literal and embeds that in the criteria string. Alternatively,
you could use a reference to the AGDate control on the form:

=DSum("TitlePoint", "tblAgilityRec",
"AGDate<=[Forms]![YourForm]![AGDate]")
 
Back
Top