Passing criteria to a query field

tjs206

Registered User.
Local time
Today, 04:53
Joined
Sep 25, 2000
Messages
37
Is it possible to pass criteria to the criteria part of a query field from Code?

I'm trying new things.

If so, can someone show me an example.

Thanks.
 
Yes it is possible.

My preferred method is to let the code build the SQL statement. Another method is to goof around with the QueryDef in code and add parameters then set set the parameter values which I've had to do a few times, but I'm not well versed (perhaps Pat can give you an example of this).

Basically, the process is like this:

For example you have a form with a combobox. The combobox has been populated with a list of all customers in your database. Now if you want to execute a query that only shows records from your order table that match the select customer, your SQL statement would be

"Select * from Orders where [CustomerID]=" & me.combobox & ";"

Is this what you are looking for, or did I over-simplify your question?
 

Users who are viewing this thread

Back
Top Bottom