?
Solved

Current Year in Query

Posted on 2014-01-20
5
Medium Priority
?
452 Views
Last Modified: 2014-01-20
I am using  a WHERE clause that properly pulls up the current week in a query. I would like a separate query to pull up current year's data. How can I change this code to be current year?

WHERE Format(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#),"wwyy") = Format(Now(),"wwyy")
0
Comment
Question by:cansevin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39794190
Here you go:
WHERE Year(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#) = Year(Date())

Open in new window

0
 
LVL 6

Accepted Solution

by:
Mahesh Bhutkar earned 2000 total points
ID: 39794209
you can try out,
WHERE Format(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#),"yyyy") = Format(Now(),"yyyy")
0
 

Author Comment

by:cansevin
ID: 39794215
Unfortunately that one didn't work. Any idea what could be wrong?
0
 

Author Closing Comment

by:cansevin
ID: 39794217
Thanks!
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39794237
I forgot a parenthesis, that's why it didn't work:
WHERE Year(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#)) = Year(Date())

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question