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

Passing Operator to Query Object

Status
Not open for further replies.

jtrembla

ISP
Jul 6, 2006
104
US
I have a combo box on a form with the >,< greater operator and a text box where user can input value.

Can I pass the operator and value to a query object, and How?

~J
 
You can build an SQL string and use the QueryDef to add it to a query, or just use it as a recordsource, if that is the aim.
 
Remou's advice is sound, but that is not the only approach.

Often you want the user to make choices, and then you want to show the user a recordset matching their choices. For example, an inventory db might have a screen that lets the user choose an itemID code. After the user pressed "submit", they would see every item with that code. This is how I would implement that:

1. Create a table called single1. It will always have exactly one record. It has the field itemID.

2. Make a form called "form1" with a dropdown menu. The ddl will have every possible itemID. When the user presses "submit", they will store the selected value in single1.itemID. Then form1 will close and form2 will open.

3. Form2 will display all of the items with the selected itemID. The query for Form2 will contain dlookup("itemID","single1") in a "where" clause.

Usually my single1 table has many fields. Each field contains a different parameter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top