Default Dates

A

Ampridge

I have a query that calculates records between two dates as

Between [Beginning Date] And [Ending Date]

Is there a way to show a default value for the beginning and ending dates in
the input boxes rather than having to enter a date every time?

Thank you for any help

Paul.
 
K

KARL DEWEY

Yes. Open the form in design view, click on the text box, right click,
scroll to bottom, click on Properties, enter a default value or formula and
select the format.
 
J

John Spencer

No, there is no way to have a default date DISPLAYED. You can however have a
default date For instance to default to a range of Jan 1 of the current year
to Dec 31 of the current year.


Between Nz([Beginning Date],DateSerial(Year(Date()),1,1))
And NZ([Ending Date],DateSerial(Year(Date()),12,31))

You could change the parameter prompt to something like:
[Beginning Date - Blank = Jan 1 Current Year]

If you want defaults, the best way is to use a FORM to get the dates. You can
set defaults for controls on a form.


Check out this article for a detailed discussion.
http://www.fontstuff.com/access/acctut08.htm

Or check out this from MS
http://office.microsoft.com/en-us/access/HA011730581033.aspx

Or for another example
http://allenbrowne.com/ser-62.html


A brief quote from a John Vinson (Access MVP) posting.

You'll need to create a small unbound Form (let's call it frmCriteria) with a
Combo Box control (cboCrit) on it. Use the combo box wizard to select the
table for the selections, and be sure that the bound field of the combo is the
value you want to use as a criterion. Save this form.

Now use

=[Forms]![frmCriteria]![cboCrit]

as the criterion in your Query.

It's convenient to base a second Form or Report on the resulting query to
display the results; if you put a button on frmCriteria to launch that form or
report, the user can enter the criterion and view the results in one simple
operation!

End quote

Keywords: Parameter Queries, comboboxes

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

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

Similar Threads

User Prompt for Month to find Date Range 3
criteria 27
criteria 1
Date Range Query 1
Between . . .And problem 1
Between dates 7
Including query dates in report 1
Query for things happening this week 2

Top