0
votes

I have an access report where I wanted to make a textbox control source dynamic based on the current date using this to limit data returned to the last 5 years based on the current date. I'm bring back the number of claims for the past 5 years based on the accident year.

Working: =Sum(IIf([accidYr]>(Year()-6),[numClaims],0))

It works just fine but............ When I click off or save and reopen the properties box it changes to: =Sum(IIf([accidYr]>2013,[numClaims],0))

The issue is that 2013 is now hard-coded and is no longer dynamic so it will lead to problems down the road.

Any suggestions? Thank you.

Tried several variations with no luck.

Working: =Sum(IIf([accidYr]>(Year()-6),[numClaims],0))

Changes to: =Sum(IIf([accidYr]>2013,[numClaims],0))

No error messages, just an Access "feature" I presume.

1

1 Answers

0
votes

Try with:

=Sum(IIf([accidYr]>(Year(Date())-6),[numClaims],0))