Link to home
Start Free TrialLog in
Avatar of Sivasan
SivasanFlag for United States of America

asked on

Pass criteria from a value on text box in access form to a query to pull exact match result or All when left blank

Hi There,
I'm trying to pass a criteria in an MS access query from a text box in form. What I like to do is check exactly for the value user enter in the text box( i don't want similar value of what user enters, say if the user enters ABC, I want result eactly matching ABC, not like ABC such as ABC , ABCD, ABCDE etc, if they leave it blank( if needed I can use something like "ALL")  then pull everything.
On the query I have it like this    [FORMS]![usrpartform]![usrPart] OR Like "*"   but  it always pulls everything.
I would appreciate if you could tell me the exact syntec to be used on the query to get the result as desired.
Thks
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can use an old trick with Nz:

Where [YourField] =  Nz([Forms]![usrpartform]![usrPart], [YourField])

Open in new window

Avatar of Sivasan

ASKER

Hi Dale.
Thanks a million.Worked good.
Thanks
Glad to help.