WildCard in IIF Statement

V

vinnypimp

My query looks at a textbox from a form as part of an IIF statement as
criteria in a query.
[CorpID] = IIF([textbox] = "a410132", Like "a*", [textbox])

When the statement is true, no records are returned, it should return all
records. A false statement returns the correct value.

What am I doing wrong? Is there any easier way to perform this query?
 
K

Ken Snell \(MVP\)

You cannot use Like in the True or False argument of the IIf function. Try
this:

[CorpID] Like IIF([textbox] = "a410132", "a*", [textbox])
 
V

vinnypimp

Awesome!! That worked perfect!!

Thanks so much!

Ken Snell (MVP) said:
You cannot use Like in the True or False argument of the IIf function. Try
this:

[CorpID] Like IIF([textbox] = "a410132", "a*", [textbox])
--

Ken Snell
<MS ACCESS MVP>





vinnypimp said:
My query looks at a textbox from a form as part of an IIF statement as
criteria in a query.
[CorpID] = IIF([textbox] = "a410132", Like "a*", [textbox])

When the statement is true, no records are returned, it should return all
records. A false statement returns the correct value.

What am I doing wrong? Is there any easier way to perform this query?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top