Solved

Current Year in Query

Posted on 2014-01-20
5
437 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
  • 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 500 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

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