Solved Help with Dsum Multi Criteria (1 Viewer)

sspreyer

Registered User.
Local time
Today, 10:04
Joined
Nov 18, 2013
Messages
251
Hi All,

i have query that calulates the month spend in one column [Month_total] then i Group it via the month using a field called [Month_] then use a sum on form to call the values

like

Code:
=DSum("[Month_Total]","[Monthly_Cost_parts_QRY]","[Month_] = '3'")
which shows the total spend for march does what i want but i would like to use a textbox to control the year but ive been unsuccessful

i added
Code:
Yeardate: DatePart("yyyy",[Order_Date])
to my query


here is what i tried but getting a error
Code:
=DSum("[Month_Total]","Monthly_Cost_parts_QRY","[Month_] = '3'" & "'[Year_date]='[YearFormTXT]'")

any help much appreciated thank in advance

Shane
 

Isaac

Lifelong Learner
Local time
Today, 10:04
Joined
Mar 14, 2017
Messages
8,738
Try:

=DSum("[Month_Total]","Monthly_Cost_parts_QRY","[Month_] = '3'" & " and [Year_date]='" & [YearFormTXT] & "'")

..that is, if Year_Date is a text field, and if YearFormTXT is a control..
 

sspreyer

Registered User.
Local time
Today, 10:04
Joined
Nov 18, 2013
Messages
251
Try:

=DSum("[Month_Total]","Monthly_Cost_parts_QRY","[Month_] = '3'" & " and [Year_date]='" & [YearFormTXT] & "'")

..that is, if Year_Date is a text field, and if YearFormTXT is a control..
thank you worked perfect :)
 

Users who are viewing this thread

Top Bottom