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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Critreria in a Query Question 1

Status
Not open for further replies.

Wrecker

Technical User
Aug 29, 2001
126
US
Is there a way to make a list box appear when using "Like" in the criteria of a query? The user currently has to type in the data to query on. I would like them to be able to pick from a list.

Thanks
Wrecker
 
Hi

Set up a form, put the list box on it

make your query criteria

Forms!MyForm!MyCombo

where MyForm and MyCombo are the anmes of your form and combo box and put a button on the form to run the query Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks... Just what I needed

Wrecker
 
Still having trouble..... I created a form with a list box.

The form name is "Cutting". the List box Name is "Cutting1".

In the criteria of the query I put:

Like ([forms]![Cutting]![Cutting1])

I get a message saying the expression is typed incorrectly or is too complex to be evaluated.

Trying to learn
Thanks
Wrecker
 
Hi,
It should be as follows:
Like "*" & [forms]![Cutting]![Cutting1] & "*"

The * is used as a wildcard character. So, if a user were to enter "ABC", the result being sent into the criteria would be "*ABC*".
HTH,
Randy Smith
California Teachers Association
 
Hi

Randy is correct, if you want to find all rows with ABC anywhere in the given column, but if you want to find (say) only those beginning ABC, then you need ABC* ie

Like [forms]![Cutting]![Cutting1] & "*"

out of interest you can also use ? to repesent a single wildcard character.

But to your question:

"I get a message saying the expression is typed incorrectly or is too complex to be evaluated."

You refer to the control as a listbox, is it a list box or a combo box?

If it is a list box, is it a simple list box (ie you can select only one item)?

Are you confident the problem lies with the criteria portio of your query,

Try the query without a criteria, does it work?

Try the query with a 'hard coded' criteria (eg Like ABC*), does it work?





Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top