[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

Current Year in Query

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
cansevin
Asked:
cansevin
  • 2
  • 2
1 Solution
 
IrogSintaCommented:
Here you go:
WHERE Year(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#) = Year(Date())

Open in new window

0
 
Mahesh BhutkarCommented:
you can try out,
WHERE Format(Nz([qryStatsforDailySalesReport].[DateField],#1/1/1950#),"yyyy") = Format(Now(),"yyyy")
0
 
cansevinAuthor Commented:
Unfortunately that one didn't work. Any idea what could be wrong?
0
 
cansevinAuthor Commented:
Thanks!
0
 
IrogSintaCommented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now