Problem with Dates in Query

T

TotallyConfused

I have a field with dates. However, I need to separate only the year in
another column. This is what I have so far but it is not working. Year:
IIF([mydatefield] = #m/d/2009#,#2009#,IIf([mydatefield]=#m/d/2010#,#2010#)).
Can somone please help me with this? Thank you.
 
M

Marshall Barton

TotallyConfused said:
I have a field with dates. However, I need to separate only the year in
another column. This is what I have so far but it is not working. Year:
IIF([mydatefield] = #m/d/2009#,#2009#,IIf([mydatefield]=#m/d/2010#,#2010#)).


How about:

MyYearField: Year(mydatefield)

Note: It is a very bad practice to use a reserved word such
as Year as something you created.
 

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