default value in parameter query

A

alecgreen

Hi

I have a parameter query that requests a 'run to date' in my query. Is
it possible to put a default value here which would meet most
requirements, but enable the user to enter a different date.

Many Thanks

Alec
 
B

Bob Barrows

alecgreen said:
Hi

I have a parameter query that requests a 'run to date' in my query. Is
it possible to put a default value here which would meet most
requirements, but enable the user to enter a different date.

Many Thanks

Alec

Try this:

where datefield >=
[Enter Run To Date in yyyy-mm-dd format (leave blank to accept default of
2011-04-20)]
or
([Enter Date in yyyy-mm-dd format (leave blank to accept default of
2011-04-20)]
is null and datefield <= #2011-01-20#)
You will likely have to declare this parameter as a date/time datatype.

Better yet, use a form to prompt for the date value. You can display the
default value in the textbox. Or, if using a calendar control, have the date
already selected when the form loads, allowing the user to change it as
required.
 
J

John Spencer

Use a parameter like the following:
= NZ([Enter Run To Date],#2012-12-31#)
If you leave the parameter prompt blank then the default value of Dec 31 2012
will be used. You can obviously, replace that default value with whatever you
wish to use.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
N

Nas Hashmi

Hi

I have a parameter query that requests a 'run to date' in my query. Is
it possible to put a default value here which would meet most
requirements, but enable the user to enter a different date.

Many Thanks

Alec

You can also use InputBox Function to set a default value.
 

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