Avatar of dailymeat
dailymeat
 asked on

What is wrong with this code?

I am getting a #ERROR


=IIf(IsNull(DSum("[amtpaid]","interest","[paiddate] between >=DateSerial(Year(Date())-1,1,1)  and date()-365")),0,DSum("[amtpaid]","interest","[paiddate] between DateSerial(Year(Date())-1,1,1) and date()-365"))


Microsoft Access

Avatar of undefined
Last Comment
Maria Barnes

8/22/2022 - Mon
Patrick Matthews

You're passing in a formula as a literal. Try this:

=IIf(IsNull(DSum("[amtpaid]","interest","[paiddate] between >=#" & DateSerial(Year(Date())-1,1,1) &"# and #" & (date()-365) & "#")),0,DSum("[amtpaid]","interest","[paiddate] between >=#" & DateSerial(Year(Date())-1,1,1) &"# and #" & (date()-365) & "#"))
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Maria Barnes

A little easier if you put it in a query to debug.  Looks like Jim's statement is correct.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23