criteria default value?

  • Thread starter Thread starter Poida3934
  • Start date Start date
P

Poida3934

I've created a query that has a from/to criteria as shown below:
=[From Pre-School Number :] And <=[To Pre-School Number :]

The possible numeric range is 1-99, so entering 7 and 7 gives you just
Pre-School 7's details, or entering 1 and 99 gives you every Pre-School's
details. Is there some way to have the "Enter Parameter Value" boxes
come up with a default value already in there (say 1 and 99 respectively),
which the user can then typeover if they choose.

Thanking you in anticipation.
 
You can create an Access Form [frmPreQuery] with 2 Textboxes (defaulted to 1
and 99) so that the user can enter different values and a CommandButton to
run the Query. Use the references to these TextBoxes as the Parameters in
your Query.

When the user wants to run the Query, open this Form first, enter the values
if reuired and then click/activate the CommandButton to run the Query.
Access will automatically replace Query Parameters (i.e.the references to
the TextBoxes) with values in the TextBoxes

--
HTH
Van T. Dinh
MVP (Access)



Poida3934 said:
I've created a query that has a from/to criteria as shown below:
=[From Pre-School Number :] And <=[To Pre-School Number :]

The possible numeric range is 1-99, so entering 7 and 7 gives you just
Pre-School 7's details, or entering 1 and 99 gives you every Pre-School's
details. Is there some way to have the "Enter Parameter Value" boxes
come up with a default value already in there (say 1 and 99 respectively),
which the user can then typeover if they choose.

Thanking you in anticipation.
 
You can't display the defaults but you can have defaults
=Nz([From Pre-School Number (Blank=1) :],1) And <=Nz([To Pre-School Number
(Blank=99):],99)

That said, using a form to get the information is a better way to do this.
See other responses to your post.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Poida3934 said:
I've created a query that has a from/to criteria as shown below:
=[From Pre-School Number :] And <=[To Pre-School Number :]

The possible numeric range is 1-99, so entering 7 and 7 gives you just
Pre-School 7's details, or entering 1 and 99 gives you every Pre-School's
details. Is there some way to have the "Enter Parameter Value" boxes
come up with a default value already in there (say 1 and 99 respectively),
which the user can then typeover if they choose.

Thanking you in anticipation.
 
Back
Top