I'm assuming that qryCharges is a query that links the two tables
together, and that it works properly (especially that all of the
field names it returns are what you expect, as opposed to Expr1,
Expr2)
DSum("[ChgAmt]","[qryCharges]", _
"[ChgID]= 1 " & _
"AND [PaymentDate] " & _
"Between #11/1/2005# And " & _
Format(Date(), "\#mm\/dd\/yyyy\#"))
You do not want [qryCharges]![ChgAmt] as the first argument: you want
strictly the name of the field.
You do not want [qryCharges]![ChgID] or [qryCharges]![PaymentDate] in
the third argument: you want strictly the names of the fields.
If this still doesn't work, please post the actual code you're using.
As well, post the SQL of qryCharges, just in case.
Joe Cilinceon said:
Ok, let me try it this way. I have a the following:
LEDGER (table)
Transaction (number that links this table to the charges)
PaymentDate (date fields)
CHARGES (table)
Transaction (links to LEDGER to get the dates needed)
ChgID
ChgAmt
Now I want a total amount for all ChgID = 1 (Rent is what 1 is) from
11/1/05 to today).
Now I need the proper syntax for the criteria section of the DSum.
Douglas J. Steele wrote:
Given how many different versions have been suggested to you, it
might be a good idea to post what you're actually trying to use!
Ofer wrote:
Try this, there are some changes
1. Add the word AND after the first criteria
2. Put the first date in the string
3. Remove the equal sign before the between
DSum("[qryCharges]![ChgAmt]","[qryCharges]","[qryCharges]![ChgID]=
1 AND [qryCharges]![PaymentDate] Between #11/1/2005# And #" &
Date() & "#")
Ok all so far have returned and Error.