Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass criteria from a text box to a query. 1

Status
Not open for further replies.

Hanss

Technical User
Feb 15, 2001
85
0
0
CH
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
 
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.
 
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.
 
Hi All,

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top