Creating a query WHERE Date>1/1/[current year]

What

Registered User.
Local time
Yesterday, 18:48
Joined
Oct 28, 2009
Messages
14
I'm trying to update a dozen or more queries that have january first of 2009 hard coded into them. So that I'm not doing this same thing again this time next year, I was hoping someone could provide me with the correct syntax for criteria of 1/1/[current year].

I've searched the forums and scoured what google returns, and still can't find out how to get the syntax to jive with access.

WHERE ((tbl.fieldDate)>#1/1/[Year(Date())]#)

Doesn't work - Anyone know how to do this?
 
Use DateSerial:

WHERE ((tbl.fieldDate)> DateSerial(Year(Date),1,1))
 
Wow, that was really quick. Thanks for the help, looks like that function is just what I need!
 
Yep, it is a good one to remember. It comes in handy quite often.
 
I tried this function for one of my queries and it didn't work. Could you take a look at it and let me know if you can see why it wouldn't work. Thanks

Here is what i put in the criteria of the Hired Date

<=DateSerial(Year(Date()-1),6,1)

I need it to return all employees that were hired less then or equal to

June 1, 2009

Instead it is including employees hired in Nov and Dec of 2009!

Any help on this is appreciated.
 
Last edited:
I tried this function for one of my queries and it didn't work. Could you take a look at it and let me know if you can see why it wouldn't work. Thanks

Here is what i put in the criteria of the Hired Date

<=DateSerial(Year(Date()-1),6,1)

I need it to return all employees that were hired less then or equal to

June 1, 2009

Instead it is including employees hired in Nov and Dec of 2009!

Any help on this is appreciated.
Try:
<=DateSerial(Year(Date())-1,6,1)

hth
Chris
 
  • Like
Reactions: SOS

Users who are viewing this thread

Back
Top Bottom