trickshot1126
Technical User
Good afternoon,
I have searched high an low and tried as many workarounds that i can think of... I am still in the same place as i was at 8 Am yesterday morning.
I am attempting to run a query that is filtered by dates. I have a form that i have created with an option group to provide options for "Single date", "Weekly", "Monthly" and "Custom" date ranges. In the query i have the date field and table along with where in the total section. For the criteria i am trying to use a nested "Iif" that uses the option group result (1-4) to pin point the info that actually filters the date properly based on the users selection.
The "Iif" statement is:
I can confirm that each date format works by itself in the criteria field... However, once it is placed inside the "Iif" statement the code always goes to "[date]" which would be the false portion of the "Iif."
I have also attempted to place the info in an unbound text box on the form and reference the textbox in the criteria field with the same result. I attempted switch and was not able to get the result needed either.
Any help would be greatly appreciated!!
Rob
I have searched high an low and tried as many workarounds that i can think of... I am still in the same place as i was at 8 Am yesterday morning.
I am attempting to run a query that is filtered by dates. I have a form that i have created with an option group to provide options for "Single date", "Weekly", "Monthly" and "Custom" date ranges. In the query i have the date field and table along with where in the total section. For the criteria i am trying to use a nested "Iif" that uses the option group result (1-4) to pin point the info that actually filters the date properly based on the users selection.
The "Iif" statement is:
Code:
=IIf([Forms]![tblRptMn]![Frame14]=1,[Forms]![tblRptMn]![SglDate],IIf([Forms]![tblRptMn]![Frame14]=4,"between " & [Forms]![tblRptMn]![BegDate] & " and " & [Forms]![tblRptMn]![EndDate],IIf([Forms]![tblRptMn]![Frame14]=3,"DatePart('m',[close_time])=" & [Forms]![tblRptMn]![MonthSel] & " And Year([close_time])=" & [Forms]![tblRptMn]![cboYr],IIf([Forms]![tblRptMn]![Frame14]=2,"DatePart('ww',[close_time])=" & Right([Forms]![tblRptMn]![CmbWkly],2) & " And Year([close_time])=" & Left([Forms]![tblRptMn]![CmbWkly],4),[Date]))))
I can confirm that each date format works by itself in the criteria field... However, once it is placed inside the "Iif" statement the code always goes to "[date]" which would be the false portion of the "Iif."
I have also attempted to place the info in an unbound text box on the form and reference the textbox in the criteria field with the same result. I attempted switch and was not able to get the result needed either.
Any help would be greatly appreciated!!
Rob