INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Pass criteria from a text box to a query.

Pass criteria from a text box to a query.

(OP)
Table1 contains 4 records:

Red
Black
Green
Pink

When I put the following in the criteria of a query I get two records:

“red” or “black”

My problem:

I have form1 with a texbox1.

I put the following in the query criteria:

Forms![form1]![texbox1]

I type the following the textbox1:

“red” or “black”

The query does not give me the records.

Is there any way to make this work??

Many Thanks
Hanss

RE: Pass criteria from a text box to a query.

What's the syntax of your actual query?

Select ??? from ??? Where ??? = "red" or "black" (that will not work)

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Pass criteria from a text box to a query.

That will never work. Think about it. Your query would resolve to something like this

Select color from some table where color = "red or black"
which will return no records since you do not have a color named 'red or black'

It would need to resolve to something like
Select color from some table where color = "red" or color = "black"

You could use a multiselect listbox and there is a faq that will write some code to do ths.

RE: Pass criteria from a text box to a query.

(OP)
Hi All,

Thank you for your posts! I was able to get what I wanted using the above link. Many Thanks!!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close