Using IIF With Input Box

TJBernard

Registered User.
Local time
Today, 21:21
Joined
Mar 28, 2002
Messages
176
I have a query that uses an Input Box to get an input value from the user. The Input Box asks for a set of initials [Like "*" & [What is the initials, leave blank for All] & "*"].

If the user enters in the initials the Input Box works correctly.

But I am trying to take this to the next level. I want the users to have the option to enter in the initials or leave the Input Box Blank to get back all the records including the records with NULL values in the Initial Field.

I know this will involve and IIF statement but I have not gotten it to work, here is what I tried...

IIf(Like "*" & [Please Enter Initials or Press Enter for All] & "*"="**",Is Null,Like "*" & [Please Enter Initials or Press Enter for All] & "*")

If anyone has any ideas please let me know.

Thank you,

T.J.
 
I haven't used in Input Box in years so I don't recall how to use it. I can tell you that if you use an unbound field on your form that this code will work in the query:

Like "*" & [Forms]![FormName]![ControlName] & "*"

And then directly below that line in your query add this line:

[Forms]![FormName]![ControlName] Is Null

Access will change it when you save the query, but it is easiest to tell you this way.

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom