Comparing Date with current Date

ds_8805

Registered User.
Local time
Today, 01:59
Joined
Jan 21, 2010
Messages
70
Hi Everyone. I have a table and one of the fields is a date field. I need to create a query based on this table such that only records from the current year is displayed. So I need to retrieve the year part from the
date and compare with the current date. I m not too sure on how to do this esp the retrieving of year part from the date. Hope someone could guide me on this! Thanks
smile.gif
 
Have a look at the DatePart() Function.

You will need something like;
Code:
DatePart("yyyy",[YourDateField])=DatePart("yyyy",Date())
As your criteria
 
The problem is that my datefield is in such a format which is dd-mmm-yy. This would def cause a problem right? since the extracted year is in yyyy format... is there a way to work ard this?
 
It shouldn't make any difference. dd-mmm-yy is only a display format, the year is still stored in full and the query will still work.
 

Users who are viewing this thread

Back
Top Bottom