Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a query to show the records of the current year? 1

Status
Not open for further replies.

arisa22

MIS
Dec 19, 2005
2
GR
How can I create a query for a report in which I want the records of this year, from 1/1/2005 Until Now (Year to Date)? Let's say that I have the tables Customers And Orders and I want the orders Group by Customers Where Orders.Date Between #1/1/2005# And Now().

I have done sth. like this
SELECT Orders.OrderID, Orders.CustomerID, Orders.ShipCountry
FROM Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
WHERE (((Orders.OrderDate) Between #1/1/2005# And Now()))
GROUP BY Orders.OrderID, Orders.CustomerID, Orders.ShipCountry;

But I want it to be dynamic, so when we will have 2006 it will get automaticly only the records of 2006
 

Hi,
Code:
WHERE ((Year(Orders.OrderDate) = Year(Now()))

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
SkipVought,
Thank You so much!
It works perfectly!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top