current year

slimjen1

Registered User.
Local time
Today, 07:39
Joined
Jun 13, 2006
Messages
562
all using access 2010. I have a date field. I need to write a query to pull out dates with current year only. ex data: 1/1/10, 1/1/11, 2/1/12, 2/1/13. Need to pull all dates with current year which would be 2/1/13. Tried in query criteria of the date field: =Format(Now(),"yyyy") I received data mismatch. this is a date/time field. Any suggestions welcomed. Thank you
 
Query criteria would be

[DateFieldNameHere] Between DateSerial(Year(Date()), 1, 1) And DateSerial(Year(Date()), 12, 31)
 
You need to create a calculated field on your data:

CurrentYear: Year([YourDataFieldHere])

Then underneath it you put in the criteria: Year(Date())
 
You need to create a calculated field on your data:
Need is such a strong word. They don't NEED to do that. That is another way to do it. But it can be done the way I showed too, without creation of a new field. Your path may be simpler though for most people to grasp and it will take care of the Time issue if there is a time associated with that date.
 
Did the word 'need' kill a close loved one? If so, I apologize. My intent wasn't to offend and bring up those harsh memories. It was simply the shortest word I could think of to convey my idea.

If you check the time stamp my post was 4 minutes after yours--it wasn't up as I was posting my reply. I never saw your post until now, my intent wasn't to correct you. What was your intent with your last post?
 

Users who are viewing this thread

Back
Top Bottom