Solved
DEFAULT VALUES IN PARAMETER QUERIES
Posted on 2000-03-21
i got this tip in my email, but I do not know where to add this code. In the form? Query? help!
And now for today's tip...
DEFAULT VALUES IN PARAMETER QUERIES
Paul Fantacci of Maryland sent a great tip for using default values in
parameter queries. In general, you can't specify a default value for a
parameter in query. For instance, let's suppose you use the same
parameter query to check sales by region. When you run the query, the
parameter expression prompts you for a region. You enter a region, and
Access then displays the results for that region.
Let's suppose you run this query for one particular region most of the
time. In that case, it would be nice if your parameter query would
default to that region. Then you could run it by accepting the
default--changing it only when you need to see the sales totals for
another region.
Paul Fantacci explains that if you use the InputBox function in your
parameter expression in the form
Eval("InputBox(""prompt:"",""title"",""defaultvalue"")")
Access displays an input box instead of the normal parameter prompt.
If you click OK, Access runs the query using defaultvalue as the
query's criteria. Or you can enter a new value, then click OK to run
the query.
TK