iif statement

Galstar

New member
Local time
Today, 13:13
Joined
Feb 24, 2005
Messages
6
Okay, I want to have a parameter that allows me to select "<" or ">"
I have a box on a form so I can pass the info to the report.

Why will this not work??

IIf([Forms]![Reports]![Math]="Less",<Date()-[Forms]![Reports]![ptExpireDays],>Date()-[Forms]![Reports]![ptExpireDays])

so if the use selects Less then do the first function otherwise do the second. Doesn't error at all. Just don't come back with any records.
 
You can't change the structure of a query on the fly. You can only supply a value for a variable, not the relational operator to use on that variable.

To do what you want, you'll need to build the entire SQL string in VBA since the SQL is dynamic.
 

Users who are viewing this thread

Back
Top Bottom