Operators (=, >, LIKE, etc) cannot be dynamic. The operator must be static, then IIf() returns parameter.
Could do something like:
WHERE fieldname LIKE IIf([Type True or All] = "True", -1, "*")
Or for less typing by user:
WHERE fieldname LIKE IIf([Type "T" for True or "A" for All] = "T", -1, "*")
.
Or this:
WHERE fieldname LIKE Choose([Type 1 for True, 2 for False, 3 for All], -1, 0, "*")
Or for text field:
WHERE fieldname LIKE IIf([enter value or ALL]="ALL", "*", [enter value or ALL])
I don't use dynamic parameterized queries - I prefer VBA to build criteria and apply to form or report. Especially advise not to use popup inputs because they cannot be validated, inputs on form can.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…