I have a complicated report that uses 6 crosstab queries to build a master query that feeds a report. The report tracks data by month during a specific year. One of the sub-queries counts the number of permit applications and displays them by month (row) and year (column). (The fields available from this query in design view are Month and 2009.) The field name in the query is "Applied: [Monthly Summary Applications].[2009]" The master query works fine on the current year, because it is built using current year data. However, in 2010 someone will have to edit the master query, which I want to avoid. I would like to replace the [2009] with a variable. I have tried using the Iif() function like this:
IIf(Eval(Month(Date())=1 And Day(Date())<28),[Monthly Summary Applications].[Year(DateAdd("yyyy",-1,Date()))],[Monthly Summary Applications].[Year(Date())]) but Jet doesn't recognize the name as a valid field.
(The reason for the Iif() function is to get the last years complete data when the report is generated up until Jan. 28, at which time it generates data for the new year.)
Is there a simple solution to this?
Thanks in advance for any ideas!
IIf(Eval(Month(Date())=1 And Day(Date())<28),[Monthly Summary Applications].[Year(DateAdd("yyyy",-1,Date()))],[Monthly Summary Applications].[Year(Date())]) but Jet doesn't recognize the name as a valid field.
(The reason for the Iif() function is to get the last years complete data when the report is generated up until Jan. 28, at which time it generates data for the new year.)
Is there a simple solution to this?
Thanks in advance for any ideas!