Contact US

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.

Students Click Here

How do u use a combo box as the criteria value in a query?

How do u use a combo box as the criteria value in a query?

How do u use a combo box as the criteria value in a query?

How do u specify the criteria value in a query to be read from a combo list on a form. I want to use the value in a combo box on a form to limit the results of a query.

If possible, an example of how to write the expression in a FoxPro query would be helpful.

For example in Access, the way I would do this is:

In the criteria part in an Access query, you would enter the location of the combo box as an expression ie.

[Forms]![frmReporting]![Combo box name]

therefore when the query is run, the value selected on the combo box will be used to limit the records.

RE: How do u use a combo box as the criteria value in a query?

Hi, Rahel.

You should be able to read the Value property, which would be in the same data type as the underlying RowSource.

For example, if you had a combo box cboState on your form, you could access like this:


(assuming no intervening containers like PageFrames).

You didn't elaborate on what you meant by "query", but an example of using it in an SQL Select would be:


You could also use the ListIndex property to tell you the *number* of the item within the list of choices.

I hope this helps...

Robert Bradley

RE: How do u use a combo box as the criteria value in a query?

You can also use a parameterized view.
For Example:

SELECT * FROM States WHERE Country = ?cCountry

Of Course, you can also design the view in the View Designer.
Then in the Interactivechange of the Combobox Write somewhat like this:

cCountry = This.Value

Excusame if my English is not good.
Edwin Dalorzo

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! Already a Member? Login

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