View Full Version : Dsum


JonyBravo
10-02-2006, 04:07 AM
Hi!
Can someone tell me why the following querie doesn't work?
txtcharges = DSum("[Charges]", "tblcharges", "[DateCharges] >= '" & startdate & "' AND [dateCharges] <= '" & enddate & "'") '

Thanks

JonyBravo

KenHigg
10-02-2006, 04:39 AM
For starters, where are you getting startdate and enddate? Off of a form?

"[DateCharges] >= '" & startdate & "' AND [dateCharges] <= '" & enddate & "'"

JonyBravo
10-02-2006, 06:25 AM
Yes, im getting it from a form. It's more like that.
txtcharges = DSum("[Charges]", "tblcharges", "[DateCharges] >= '" & [forms].[frmCharges]![startdate] & "' AND [dateCharges] <= '" & [forms].[frmCharges].[enddate] & "'")

Thanks

KenHigg
10-02-2006, 06:40 AM
You may need to use pound signs (#), instead of quotes around the value place holders.

"[DateCharges] >= #" & [forms].[frmCharges]![startdate] & "# , etc...