Hi, all! I am using a form to pass multiple parameters to a query. Depending on the options selected in the form, a certain set of dates are returned. There are three categories and for each category there are three options.
In a multiple table query, there a nine fields that match the nine options. I have developed a conditional IIF Statement to test each field for the selected option. If the the options passed to the field are true, the date range is allowed to pass and the recordset that matches the date range is returned. If it is false, I want the field to allow the return of all dates, not just records that are not null (like there is no criteria).
However, when I include two options for two fields in a date category, only one record is returned - the one record that is not null for that field. This is very difficult to explain. I have included a few of the criteria expressions to show you how I have set it up.
RA Report (Category 1)Option 1 ("Due Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![BeginDate],[RA Report].[RADue]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![EndDate],[RA Report].[RADue])
RA Report (Category 1) Option 2 ("Actual Completion Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Actual Completion Date",[Forms]![RptDialogBoxFrm]![BeginDate],[RA Report].[RAComp]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Actual Completion Date",[Forms]![RptDialogBoxFrm]![EndDate],[RA Report].[RAComp])
CSP Report (Category 2) Option 1 ("Due Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=2 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![BeginDate],[CSP Report].[CSPDue]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=2 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![EndDate],[CSP Report].[CSPDue])
When Option 2 is false, it should return all dates from Option 1. It only returns non-null records for Option 2. I appreciated any suggestions that you may have!
THANKS!
In a multiple table query, there a nine fields that match the nine options. I have developed a conditional IIF Statement to test each field for the selected option. If the the options passed to the field are true, the date range is allowed to pass and the recordset that matches the date range is returned. If it is false, I want the field to allow the return of all dates, not just records that are not null (like there is no criteria).
However, when I include two options for two fields in a date category, only one record is returned - the one record that is not null for that field. This is very difficult to explain. I have included a few of the criteria expressions to show you how I have set it up.
RA Report (Category 1)Option 1 ("Due Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![BeginDate],[RA Report].[RADue]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![EndDate],[RA Report].[RADue])
RA Report (Category 1) Option 2 ("Actual Completion Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Actual Completion Date",[Forms]![RptDialogBoxFrm]![BeginDate],[RA Report].[RAComp]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=1 And [Forms]![RptDialogBoxFrm]![DateType]="Actual Completion Date",[Forms]![RptDialogBoxFrm]![EndDate],[RA Report].[RAComp])
CSP Report (Category 2) Option 1 ("Due Date")
Between IIf([Forms]![RptDialogBoxFrm]![RptType]=2 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![BeginDate],[CSP Report].[CSPDue]) And IIf([Forms]![RptDialogBoxFrm]![RptType]=2 And [Forms]![RptDialogBoxFrm]![DateType]="Due Date",[Forms]![RptDialogBoxFrm]![EndDate],[CSP Report].[CSPDue])
When Option 2 is false, it should return all dates from Option 1. It only returns non-null records for Option 2. I appreciated any suggestions that you may have!
THANKS!