Convert date to year

T

Tandy

Hi Everyone,

I have another question regarding dates, but I think this one is simple.
Say, for simplicity’s sake, I have two fields in my query. One is called
“MonthlyHoursDate†with the following criteria: “>=[Type Beginning Date:]
And <=DateSerial(Year([Type Beginning Date:]),Month([Type Beginning
Date:])+1,0)†I have another field called “YearAssignedâ€, which has a number
data type, with just the year, such as 2005 and 2006. Is there anyway that I
can have a criteria take the date, say 11/1/2006, and then filter the
“YearAssigned†by the year, so 2006. Is that possible? Thank you for your
help!!!

Tandy
 
T

Tom Lake

Tandy said:
Hi Everyone,

I have another question regarding dates, but I think this one is simple.
Say, for simplicity’s sake, I have two fields in my query. One is called
“MonthlyHoursDate†with the following criteria: “>=[Type Beginning Date:]
And <=DateSerial(Year([Type Beginning Date:]),Month([Type Beginning
Date:])+1,0)†I have another field called “YearAssignedâ€, which has a number
data type, with just the year, such as 2005 and 2006. Is there anyway that I
can have a criteria take the date, say 11/1/2006, and then filter the
“YearAssigned†by the year, so 2006. Is that possible? Thank you for your
help!!!

Tandy

Compare with Year([yourdate]) The Year function returns the year of a given date.

Tom Lake
 
T

Tandy

Hi Everyone,

I think I figured it out. I used the following criteria in my YearAssigned
field:

Format([Type Beginning Date:],"yyyy")

Let me know if this is a big mistake! Thank you!

Tandy
 
J

John Vinson

Hi Everyone,

I think I figured it out. I used the following criteria in my YearAssigned
field:

Format([Type Beginning Date:],"yyyy")

Let me know if this is a big mistake! Thank you!

NOt a big mistake, but that's a bit less efficient than just using

Year([Type Beginning Date:])

John W. Vinson[MVP]
 
T

Tandy

Hi John,

Thanks for the advice. I definitely want things to be efficient!

Tandy


John Vinson said:
Hi Everyone,

I think I figured it out. I used the following criteria in my YearAssigned
field:

Format([Type Beginning Date:],"yyyy")

Let me know if this is a big mistake! Thank you!

NOt a big mistake, but that's a bit less efficient than just using

Year([Type Beginning Date:])

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top