Like in a paramater query

C

Chris

I'm having a problem with this paramater query:

IIf([Show 322 records? (Y/N)]="Y",Like "322*")

It prompts the user to type Y or N, and if it's "Y" I want it to return
records like 322-123, 322-4567, 322-xxx etc, but it doesn't return any
results. If I eliminate the Like part of it, it works find by entering the
exact 322-xxx record, but not using the like statement. What am I doing
wrong?
 
K

KARL DEWEY

Try this --
Like IIf([Show 322 records? (Y/N)]="Y", "322*","*")

This will return all records if 'Y' is not what is entered.
 
C

Chris

AHA! The "Like" is in front of the IIf statement. That solved the issue,
thanks

KARL DEWEY said:
Try this --
Like IIf([Show 322 records? (Y/N)]="Y", "322*","*")

This will return all records if 'Y' is not what is entered.

Chris said:
I'm having a problem with this paramater query:

IIf([Show 322 records? (Y/N)]="Y",Like "322*")

It prompts the user to type Y or N, and if it's "Y" I want it to return
records like 322-123, 322-4567, 322-xxx etc, but it doesn't return any
results. If I eliminate the Like part of it, it works find by entering the
exact 322-xxx record, but not using the like statement. What am I doing
wrong?
 
J

Jeff L

Make a Field with [Show Records] in it in the query. Put Like "322*"
in the criteria of your other field and "Y" in the criteria of [Show
Records]. Then on the next line of criteria, put Not Like "322*" and
"N" in the respective spots.

Hope that helps!
 

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