using DSUM and struggling

Richhol65

Registered User.
Local time
Today, 19:34
Joined
Aug 24, 2013
Messages
43
Hi

Hopefully someone can help.

I am trying to use dsum to calculate a sum from either a table or query to display on a form and this needs to be for different services within a period so I am using the following:

Code:
Me.txtTotalEarnings = DSum("Price", "KatiesPeriodTakings", "AppDate" >= CDate([Forms]! _& 
[frmKatiesTakings]![txtStartDate]) And "AppDate" _& 
 <= CDate([Forms]![frmKatiesTakings]![txtEndDate]))
But I keep getting a mismatch error

The Query is called KatiesPeriodTakings
The field I want totalled is called Price
The date field is AppDate and the 2 controlling dates are the Startdate and EndDate from the Form

Thanks

Rich
 
Thanks PBaldy

I have now changed the code to this:

Code:
Me.txtTotalEarnings = DSum("Price", "KatiesPeriodTakings", _ &
 "AppDate" >= CDate([Forms]![frmKatiesTakings]![txtStartDate]) And _ &
"AppDate" <= CDate([Forms]![frmKatiesTakings]![txtEndDate]))

But I am still getting a type mismatch

Thanks

Rich
 
Have you tried the syntax and # delimiter from the link?
 
Paul

Thanks for that it is now working perfectly

Cheers

Rich
 
Happy to help Rich.
 

Users who are viewing this thread

Back
Top Bottom