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.
 

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

Similar Threads

Date Brackets as an IIf statement 3
Iif Query 5
query for dates 2
Grouping - Distinct 5
Date Expressions & Calculations 3
Date query 3
Select Top Query 2
Counting fields in a table row 1

Back
Top