Link to home
Start Free TrialLog in
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"))


Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

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
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A little easier if you put it in a query to debug.  Looks like Jim's statement is correct.