help with DSum

  • Thread starter Thread starter Graham Mandeno
  • Start date Start date
G

Graham Mandeno

Hi Lee

The condition argument should be:
"Year([BeginDate])=" & Year(Me.BeginDate)
 
I am trying to sum up all the value sof txt3 when a command button is
clicked, using DSum. The DSum is only to add up all the values that are with
in the current year (= whatever the year entered in the BegiinDate box).
The DSum is to goto the "MICU Information" add up all those = the same year
as in BeginDate (field is also called begin date in this table.

but i cant get it to work, Why?

Me.txt3 = DSum("[txt3]", "micu information", "begindate =" &
Format([BeginDate], YYYY) = Format(Me.BeginDate, YYYY))

Please help

Lee
 
A faster alternative that I use, is create a sum query
that returns a single record and then do a Dlookup on that
query. I think that you will find this is a lot faster,
especially if you are trying to sum several thousand
records. Another advantage is that you don't need to
supply any criteria because it will automatically return
the first record.
I know this isn't what you asked for but it might be of
assistance anyway.

Regards
Paul
 
Back
Top