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

Queries passed through forms

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
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.

satya33@hotmail.com
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top