Problem with Dates in Query

  • Thread starter Thread starter TotallyConfused
  • Start date Start date
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.
 
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.
 
Back
Top