Glad you figured it out, and John Vinson gives some good
info.
Look in Help under Domain Aggregate Functions for more
info. There are 3 arguments to the function and they are
all string arguments. Strings need to be in quotes if
typed literally, or can be variables like field values, or
can be a combination of the two. Field names, in Access,
are specified by square braces [].
So in my DSum function, first comes the name of the field
to sum, which is your Amount field, or [Amount]. Next
comes the table name. Those are easy. After that I am
constructing a string to tell Access the condition that
specifies which records need to be included when adding
together the Amounts. I need to say in Access terms "When
the Field called Date is equal to (insert date here) and
the field called TableKey is less than (insert current
TableKey value here)."
What I put inside the quotes is setting up the condition
to be checked (and this does not change from record to
record, so it can all be typed in literally). However,
the actual values of the Date and TableKey will change
from record to record, so I need to insert them into the
sentence I am typing. When that happens, I exit
the 'quoted' part of the string I am typing and I append
(with '&') the field name that contains the value to use
for the current record, which is inside the square braces.
And you are correct: to get Access to understand a date,
you surround it with the #'s.
A very brief lesson in syntax but I hope it clears up some
of the mysteries.
Ken Dales
-----Original Message-----
Never mind, I sort of figured it out, though I don't
understand what I'm constructing with these concatenations.
-----Original Message-----
K Dale gave me the following code in response to a post of
mine:
Accumulated
Sum("[Amount]","TABLE1","[Date]=#"&[Date] &"#
And [TableKey]<="&[TableKey])
I need to modify this, but can't figure out the syntax. I
gather that the #s indicate a date, and the & is to
concatenate strings, but the quotes make no sense to me
and seem very erratic. Yet when I try to add more
criteria, I can't figure out where the quotes go.
Help!
Alan
.
.