Solved

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

Posted on 2011-09-06
4
213 Views
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?
0
Comment
Question by:QMBB
[X]
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
4 Comments
 
LVL 120

Accepted Solution

by:
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()
0
 

Author Comment

by:QMBB
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.
0
 
LVL 120

Expert Comment

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

Author Comment

by:QMBB
ID: 36492426
Beautiful, thanks again very much.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

752 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