Automatically change an Access Queries

K

Kathy

Is there a way in code to automatically change the criteria in a
query? I want to make the change based on a value selected in a drop
down box.

Thanks,
 
V

Van T. Dinh

You can use the QueryDef Object (DAO Library needed in the References) to
modify the SQL String of the Query. You can also use ADO Catalog.
 
J

John Vinson

Is there a way in code to automatically change the criteria in a
query? I want to make the change based on a value selected in a drop
down box.

Thanks,

The simplest way is to directly reference the form and the combo box
in the Criteria cell of the query grid: just type

=[Forms]![NameOfYourForm]![NameOfYourComboBox]

using your own form and combo box names, of course. The form must be
open for this to work; but you can put a command button on the form to
open a Report or another Form in which to display the query data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top