DSum with multiple criteria in vba: problem with the year - Microsoft Community


the following code doesn't work.  i keep getting invalid use of null error.

everything worked until added information year need this.  have total curamountofcheck (there can many four) year of record looking at.

the [year] field calculated field in query:  year([dtmseriesenddate]).  though null error information shows in debug [year] = 2017 correct year don't know why keep getting message.

i appreciate can get.  thanks.

dim curtotal currency

curtotal = dsum("[curamountofcheck]", "tblseries", "[txtidnumber] = '" & [txtidnumber] & "'" & _
 " , [txtdependentcode] ='" & [txtdependentcode] & "'" & _
 " , [year] = '" & "#" & [year] & "#" & "'")

if curtotal > 150 then
msgbox "the total has exceeded $150.00"
end if

i figured out.  needed use qryseries instead of tblseries since year calculated field in query.  works should.

i appreciate , helped me learn more debug.print.

do points of this?



Office / Access / Windows other / Office 2010



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community