Access 2003 query, return todays date from date/time field

Posted on 2011-09-06
Last Modified: 2012-05-12
Date() doesn't seem to work with a date/time field, because it returns zero records even though there are records from today. How do I work around that?
Question by:QMBB
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 500 total points
ID: 36492312
try this query

select * from table
where [dateField] between Date() and Date()+1

or this

select * from table
where datevalue([dateField])= Date()

Author Comment

ID: 36492347
That second one works perfectly, thanks very much. One last question related to that.... is there a way to sort the results of that date/time field? In the datasheet view it can be sorted, but in the form which displays the results, it just displays them random, even if I set the query properties to ascending on that field.
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36492365
select * from table
where datevalue([dateField])= Date()
order by [dateField]

Author Comment

ID: 36492426
Beautiful, thanks again very much.

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question