query iff criteria

dpotts

Registered User.
Local time
Yesterday, 18:32
Joined
Jul 3, 2008
Messages
10
Hello, I'm trying to filter a query depending on what text boxes on a form are enabled. I have it in an iif statement and I'm trying to check if the text boxes are enabled or not then go from there.
It doesn't seem to be checking the text boxes correctly or something else is wrong. Not sure. Any help would be great.

This is what i have so far.

IIf ( [Forms]![frmLMBSearch]![txtTitle].[enabled]=True, Like "*" & [Forms]![frmLMBSearch]![txtTitle].Text & "*" , )

so.. if the text box is enabled enter the text in the criteria, if it is not enabled don't put anything in the criteria
 
Try this:

IIf ([Forms]![frmLMBSearch]![txtTitle]<>"",[Forms]![frmLMBSearch]![txtTitle]& "*" ,"*")

Don't have time to test this, but I believe it should work.
 
Still nothing. I enter that in
IIf ([Forms]![frmLMBSearch]![txtTitle]<>"",[Forms]![frmLMBSearch]![txtTitle]& "*" ,"*")
and I get no results with or without text in the specified text box.
 
The value of checkboxes are -1 and 0. If the checkbox is checked, it will be -1. Therefore, try:

Code:
IIf ([Forms]![frmLMBSearch]![txtTitle]=-1,[Forms]![frmLMBSearch]![txtTitle]& "*" ,"*")

I hope that helps.

Jeremy
 
Solved it with putting this in the sql:

Code:
(IIf(Forms!frmLMBSearch!txtTitle.enabled=True,(tblLMB.Title) Like "*" & Forms!frmLMBSearch!txtTitle & "*")<>False)

Looks like I just needed (tblLMB.Title) in the iif statement \=
I'm not sure what the <>False is doing, but access automatically puts that in there and it works. Thanks for all the help guys.
 

Users who are viewing this thread

Back
Top Bottom