This is a little different from most other questions on having queries based on Combobox values. I have reports that are generated from a query. For each of these reports the users can select different options for the data to be displayed on the report. Using one field as an example, [Status], the combo box has four choices: Open, Closed, Void and All. I can get the query to work with the first three choices because they are all possible entries in the source table. The "All" is the problem. Since it is not a possible entry in the table I have tried numerous ways to use an IIF statement specifying if "All" is in the combobox then the criteria is to pull either Open or Closed records and otherwise to set the criteria equal to the value in the combobox. Here are a couple of ways I have tried:
WHERE ((tblShortages.Status)=(IIF(([Forms]![frmMain]![frmReports].[Form]![Combo50]="All"),(“Open" OR "Closed"),((tblShortages.Status)=([Forms]![frmMain]![frmReports].[Form]![Combo50]))))
and I also tried:
WHERE ((tblShortages.Status)=(IIF(([Forms]![frmMain]![frmReports].[Form]![Combo50]="All"),(((tblShortages.Status)="Open") OR ((tblShortages.Status)="Closed")),((tblShortages.Status)=([Forms]![frmMain]![frmReports].[Form]![Combo50]))))
John Green
WHERE ((tblShortages.Status)=(IIF(([Forms]![frmMain]![frmReports].[Form]![Combo50]="All"),(“Open" OR "Closed"),((tblShortages.Status)=([Forms]![frmMain]![frmReports].[Form]![Combo50]))))
and I also tried:
WHERE ((tblShortages.Status)=(IIF(([Forms]![frmMain]![frmReports].[Form]![Combo50]="All"),(((tblShortages.Status)="Open") OR ((tblShortages.Status)="Closed")),((tblShortages.Status)=([Forms]![frmMain]![frmReports].[Form]![Combo50]))))
John Green