Query criteria

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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]
 
Back
Top