I have a report that has several of these IIf statements for changing the photo depending on the date.
It works but seems like it is just the "wrong" way to do it. One reason is because the only way to change the data (Photo) is by going to each statement on the report design view to do it. Plus it is a pain to code this for every photo slot. And it does take some time for the report to paginate when I print it, but not sure if it is the code, but I suspect it is because the report is only about 10 pages.
Problem with the report it is from a Cross-tab Query so I can't really (or at least I don't know how to) add these fields to that query.
Thought I would throw it out there and see what others think.
Code:
=IIf([Expr1] Between #7/5/2016# And #8/16/2016#,"\\Server\Dir\Subdir\photo1.png",IIf([Expr1] Between #8/17/2016# And #8/30/2016#,"\\Server\Dir\Subdir\photo2.png",IIf([Expr1] Between #8/31/2016# And #9/27/2016#,"\\Server\Dir\Subdir\photo3.png",IIf([Expr1] Between #9/28/2016# And #10/7/2016#,"\\Server\Dir\Subdir\photo4.png",IIf([Expr1] Between #10/8/2016# And #10/27/2016#,"\\Server\Dir\Subdir\photo5.png",IIf([Expr1] Between #10/28/2016# And #11/17/2016#,"\\Server\Dir\Subdir\photo6.png",IIf([Expr1] Between #11/18/2016# And #11/30/2016#,"\\Server\Dir\Subdir\photo7.png","\\Server\Dir\Subdir\photoblank.png")))))))