Steve R.
Retired
- Local time
- Yesterday, 19:43
- Joined
- Jul 5, 2006
- Messages
- 5,651
My understanding of the LIKE operator seems to be deficient for filtering a query when using the Access query pane. I have a combo box that lists the values to be filtered. One option in the combo box is "No Selection". If "No Selection" is selected, I want the filter turned off, in other words ALL records are shown.
In theory the following code would seem to be correct when placed in the criteria line. It does not work:
If the value of COMBO2 =24 (No Selection), then I would like all records to show up, but no records are displayed. The FALSE side of the IIF statement works correctly.
As an experiment I tried LIKE by itself and it displayed all the records:
Another failed try:
AGENCY is the fieldname.
A more exotic attempt that failed:
Any thoughts?
In theory the following code would seem to be correct when placed in the criteria line. It does not work:
Code:
IIf([forms]![type5frm].[combo2]=24,Like "*",[forms]![type5frm].[combo2])
If the value of COMBO2 =24 (No Selection), then I would like all records to show up, but no records are displayed. The FALSE side of the IIF statement works correctly.
As an experiment I tried LIKE by itself and it displayed all the records:
Code:
LIKE "*"
Another failed try:
Code:
IIf([forms]![type5frm].[combo2]=24,[agency]) Like "*",[forms]![type5frm].[combo2])
A more exotic attempt that failed:
Code:
IIf([forms]![type5frm].[combo2]=24,Val(Str([agency]) Like "*"),[forms]![type5frm].[combo2])
Any thoughts?