Query criteria

V

Vincent Johns

Steve said:
Is it possible to set the criteria of a query at runtime rather than in
design view?

Certainly it's possible. And easy, too, if you don't mind using VBA. :)

Seriously, you could affect the way a Query runs in various ways, such
as setting a control on a Form to have a value that the Query could
read, or defining a [Parameters] Table (I usually put just one record in
it) containing a field that your Query can read, etc.

What do you want the Query to do? How do you want to be able to change
how it runs?

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 
J

John Vinson

Is it possible to set the criteria of a query at runtime rather than in
design view?

A Parameter Query is a pretty standard technique to do this. Rather
than a parameter like "Jones" you can use a prompt in square brackets,
such as [Enter last name:]

Even better, you can create a Form with unbound controls, and use

[Forms]![NameOfForm]!{NameOfControl]

as the criterion. The query will look to the form for the user's
input.


John W. Vinson[MVP]
 

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