Pull date field from a Form

RevJeff

Registered User.
Local time
Today, 18:54
Joined
Sep 18, 2002
Messages
129
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:

Code:
>=[Forms]![frmAdhoc].[Date]
or
Code:
<=[Forms]![frmAdhoc].[Date]
or
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!
 
You cant really do that that way.... or atleast shouldnt ....

Research "Querydefs" for a bit to see how you can custom build your SQL to suite your needs for this and beyond this question.
 
Can you post the SQL statement of your query and the code for the command button that this query will execute.
 

Users who are viewing this thread

Back
Top Bottom