Help! Query which date as a criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I want to make a query to show the transaction of today. But the date data is full date and time in the table. I use the condition date=Date() but there is no shown in the query. Please Help
 
Hi Danny!

Have you tryed with NOW()?

// Niklas


Danny said:
Hi all,

I want to make a query to show the transaction of today. But the date data
is full date and time in the table. I use the condition date=Date() but
there is no shown in the query. Please Help
 
You have almost diagnosed your own problem in your question. You tell
us that your date field contains date and time parts. The value
returned by Date() is a date number with no time part, corresponding
to midnight on the given date. Unless you have records with an
identical date _and_ _time_ value, your query will be empty. The most
straightforward way of getting all records having today's date (and
any time) is to use the condition:

Between Date() And (Date() +1)

For the pedant, this will include records dated exactly at midnight at
the end of the day in question. If that is undesirable, you can use
..9999 instead of 1 in the calculation.

Hi all,

I want to make a query to show the transaction of today. But the date data is full date and time in the table. I use the condition date=Date() but there is no shown in the query. Please Help

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top