From: Iago on
I have a table which contains a field called "DUEDATE", data type is
DATE/TIME, formatted as LONGDATE. I use it to enter in dates when projects
are due.
How can I write a query which returns "DUEDATE" items for the current date.
Example: Today is January 21, 2010 and I want to retrieve everything from
the table with "DUEDATE" of january 21,2010.
From: Duane Hookom on
If you only store the date part and only want to return records where the
DueDate is the current date, set the criteria under DueDate to:
=Date()

Duane Hookom
MS Access MVP

"Iago" <Iago(a)discussions.microsoft.com> wrote in message
news:87EFBCFB-4B14-4B44-810B-6D25DDF98018(a)microsoft.com...
> I have a table which contains a field called "DUEDATE", data type is
> DATE/TIME, formatted as LONGDATE. I use it to enter in dates when projects
> are due.
> How can I write a query which returns "DUEDATE" items for the current
> date.
> Example: Today is January 21, 2010 and I want to retrieve everything from
> the table with "DUEDATE" of january 21,2010.

From: John W. Vinson on
On Thu, 21 Jan 2010 06:41:01 -0800, Iago <Iago(a)discussions.microsoft.com>
wrote:

>I have a table which contains a field called "DUEDATE", data type is
>DATE/TIME, formatted as LONGDATE. I use it to enter in dates when projects
>are due.

The format is irrelevant - it only controls how the data is displayed. A more
important question is what are you storing in the field? Does DUEDATE contain
values like just 1/21/2010, or 1/21/2010 1:00PM?

An Access Date/Time values is actually stored as a Double Float number, a
count of days and fractions of a day (times) from a startpoint. The format
controls how that number is displayed.

>How can I write a query which returns "DUEDATE" items for the current date.
>Example: Today is January 21, 2010 and I want to retrieve everything from
>the table with "DUEDATE" of january 21,2010.

If you want to search for just today's date, AND the field contains no time
portion, just use

=Date()

in the criteria line. If the field does contain times, use

>= Date() AND < Date()+1

to get all values from midnight last night up to just before midnight tonight.

To get data for a specific date use a criterion such as

#1/21/2010#

(the # marks delimit date values); better, use a Parameter Query. Post back if
you'ld like more info on these.
--

John W. Vinson [MVP]