I have an option group (TimeFrameOption) with three options: All, Last 6 months, and Last 12 Months. When an option is selected, I want to query dates in a listbox (CallReport) to display all dates (I used Date() - 9999999999 days for all), dates within the last six months, or dates within the last year.
I placed this formula in the criteria in the SQL query builder for the listbox.
IIf([timeframeoption]=1,[CallReport].[Date] Between Date()-9999999999 And Date(),IIf([timeframeoption]=2,[CallReport].[Date] Between Date()-180 And Date(),([CallReport].[Date]) Between Date()-365 And Date()))
I used only the between and statements and Access added [CallReport].[Date] to the syntax.
I tested the date formulas invididually and they all work fine outside of the IIF statement. For instance, Between Date() and Date() -180 shows all records for the last 6 months.
Any suggestions on the syntax of the IIF statement?
Thanks,
Jason