Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

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

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
QMBB
Asked:
QMBB
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
try this query

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

or this

select * from table
where datevalue([dateField])= Date()
0
 
QMBBAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
select * from table
where datevalue([dateField])= Date()
order by [dateField]
0
 
QMBBAuthor Commented:
Beautiful, thanks again very much.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now