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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting data from this year's month 1

Status
Not open for further replies.

Chummly66

MIS
Feb 19, 2005
106
US
I have this code which allows me to enter the month, and the query will give me the data I need. But, I found that since I have data from september 2005, it pulls from that september as well as the current september. The code is listed below... is there any way I can do this so only the current year's data is pulled, ignoring last year's "september"?

thanks in advance guys!!

PARAMETERS [Forms]![Workorders]![txtDateToRepair] Long;
TRANSFORM Count(Workorders.WorkOrderID) AS CountOfWorkOrderID
SELECT Workorders.cboManufacturer, Workorders.cboModels, Count(Workorders.WorkOrderID) AS [Total Of WorkOrderID]
FROM Workorders
WHERE (((Month([txtDateToRepair]))=[Forms]![Workorders]![txtDateToRepair]))
GROUP BY Workorders.cboManufacturer, Workorders.cboModels
PIVOT Workorders.cboCategory;
 
Code:
PARAMETERS [Forms]![Workorders]![txtDateToRepair] Long;
TRANSFORM Count(Workorders.WorkOrderID) AS CountOfWorkOrderID
SELECT Workorders.cboManufacturer, Workorders.cboModels, Count(Workorders.WorkOrderID) AS [Total Of WorkOrderID]
FROM Workorders
WHERE (((Month([txtDateToRepair]))=[Forms]![Workorders]![txtDateToRepair])) [red]AND Year([txtDateToRepair]) = Year(Date())[/red]
GROUP BY Workorders.cboManufacturer, Workorders.cboModels
PIVOT Workorders.cboCategory;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top