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

Queries passed through forms

Queries passed through forms

Queries passed through forms

Hi, guys. I am a novice in developing access and doing a project for one of my courses. Its a human computer interaction course and I need to develop a user interface to feed valid queries to an access database supplied to us by our instructor.

I have no idea whatsoever as to where I could start. I think I can do the queries by themselves in access but the part of linking a query to a form is troubling me. I wish somebody could give me an hint for the same.

In case i am not clear in my description above please let me know.


RE: Queries passed through forms

You'll probably want to build an SQL statement as a string, and then execute it and display the results, or assign it to the RowSource property of another form, or even create a QueryDef object from it and then open that.

The WHERE clause in the SQL string would contain a logical expression built up out of terms that represent the user's selections on your form. A select might have a combo box for choosing a field, a list box for choosing an operator, and a text box for specifying a value. From these you could build up a subexpression by concatenating their values: <fieldname> <operator> <value>.

You might even want to show a list of fields and let the user select which ones to retrieve from the database--a multiselect ListBox would be ideal for this.

You can fill the field lists by accessing the TableDef object for the table, then iterating through its Fields collection. Each item in the colleciton is a Field object that represents one of the fields in the table. The Name property of the Field object gives the field name.

I'm not sure how advanced your class is. Maybe this is over your head a bit. If so, I'm sorry.

Rick Sprague

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