Hopefully I will be able to explain this properly. I have a query that is pulling a date from a Form. In my Query Criteria, I can put:
or
or
And it works fine, but I don't want to hardcode the ">=", "<=" or "="
I would like the user to be able to choose ">=", "<=" or "=", from another field on the Form, so I am trying to code it on the query like this:
But it isn't working for the ">=" or the "<=". It just gives me a blank result.
Any help would be greatly appreciated.
Thanks in advance!
Code:
>=[Forms]![frmAdhoc].[Date]
Code:
<=[Forms]![frmAdhoc].[Date]
Code:
=[Forms]![frmAdhoc].[Date]
And it works fine, but I don't want to hardcode the ">=", "<=" or "="
I would like the user to be able to choose ">=", "<=" or "=", from another field on the Form, so I am trying to code it on the query like this:
Code:
IIf([Forms]![frmAdhoc].[Variable]=">=",>=[Forms]![frmAdhoc].[Date],IIf([Forms]![frmAdhoc].[Variable]="<=",<=[Forms]![frmAdhoc].[Date],IIf([Forms]![frmAdhoc].[Variable]="=",[Forms]![frmAdhoc].[Date])))
But it isn't working for the ">=" or the "<=". It just gives me a blank result.
Any help would be greatly appreciated.
Thanks in advance!