The last 6 months of data between the 1st and the last day of the month - TechRepublic
Question
January 14, 2008 at 11:04 AM
jonesn

The last 6 months of data between the 1st and the last day of the month

by jonesn . Updated 18 years, 5 months ago

I have been stuck on this for about a month. I am trying to get a query to count and show the last month of specific barcode prefix data that is between the first and the last day of the last month.

This is what I got so far, but I get a data mismatch error. I’m also using Access 2003 and I am pretty much a novice to Access and SQL.

SELECT Count(tblComponentInventory.Date) AS Month5ValveCount
FROM tblComponentInventory
WHERE (((tblComponentInventory.Date)=DateAdd(“dd”,-(Day(DateAdd(“mm”,1,”now()”))-1),DateAdd(“mm”,-1,”now()”)) And (tblComponentInventory.Date)=DateAdd(“dd”,-Day(DateAdd(“m”,1,”now()”)),DateAdd(“m”,-1,”@Today”))) AND ((tblComponentInventory.EquipmentID) Like “??VC*” Or (tblComponentInventory.EquipmentID) Like “??VO*”));

Any help would be highly appreciated.

TIA

This discussion is locked

All Comments