Now i had group my data in year, my report will only show all the data in year.
But if i want to group data in month to make all data show in that month only, how to modifyt my sql statement?
Example: now the database consits of MARCH data, when it reach APRIL, it will no data to show in report.
report: rptstockonhand1
source: qrystockOnHand1 (make up of qryLotOutput and qryTaken)
this report is to show the stockonhand, it is quantity created - quantity taken..
below is my query
qryLOtOutput:
SELECT [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], Sum([tblLotCreated].[QtyCreated]) AS SumOfQtyCreated, [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy') AS [Year], [tblLotCreated].[LotID]
FROM tblProduct INNER JOIN tblLotCreated ON [tblProduct].[ProductNo]=[tblLotCreated].[ProductNo]
GROUP BY [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy'), [tblLotCreated].[LotID];
qryTaken::
SELECT [tblTaken].[ProductNo], Sum([tblTaken].[QtyTaken]) AS SumOfQtyTaken, Format$([tblTaken].[DateTaken],'yyyy') AS [Year]
FROM tblTaken
GROUP BY [tblTaken].[ProductNo], Format$([tblTaken].[DateTaken],'yyyy');
qryStockOnHand1::
SELECT [qryLotOutput].[Year], [qryLotOutput].[LotID], [qryLotOutput].[ProductNo], [qryLotOutput].[LineStator], [qryLotOutput].[SumOfQtyCreated] AS SumOfSumOfQtyCreated, IIf([qryTaken].[SumOfQtyTaken] Is Null,0,[qryTaken].[SumOfQtyTaken]) AS SumOfSumOfQtyTaken, [qryLotOutput].[Model]
FROM qryLotOutput LEFT JOIN qryTaken ON ([qryLotOutput].[ProductNo]=[qryTaken].[ProductNo]) AND ([qryLotOutput].[Year] Like [qryTaken].[Year])
WHERE [qryLotOutput].[Year]=year(now())
ORDER BY [qryLotOutput].[Year];
how to modify it?
thx
But if i want to group data in month to make all data show in that month only, how to modifyt my sql statement?
Example: now the database consits of MARCH data, when it reach APRIL, it will no data to show in report.
report: rptstockonhand1
source: qrystockOnHand1 (make up of qryLotOutput and qryTaken)
this report is to show the stockonhand, it is quantity created - quantity taken..
below is my query
qryLOtOutput:
SELECT [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], Sum([tblLotCreated].[QtyCreated]) AS SumOfQtyCreated, [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy') AS [Year], [tblLotCreated].[LotID]
FROM tblProduct INNER JOIN tblLotCreated ON [tblProduct].[ProductNo]=[tblLotCreated].[ProductNo]
GROUP BY [tblProduct].[LineStator], [tblLotCreated].[ProductNo], [tblProduct].[Model], [tblLotCreated].[StoreLocation], Format$([tblLotCreated].[DateCreated],'yyyy'), [tblLotCreated].[LotID];
qryTaken::
SELECT [tblTaken].[ProductNo], Sum([tblTaken].[QtyTaken]) AS SumOfQtyTaken, Format$([tblTaken].[DateTaken],'yyyy') AS [Year]
FROM tblTaken
GROUP BY [tblTaken].[ProductNo], Format$([tblTaken].[DateTaken],'yyyy');
qryStockOnHand1::
SELECT [qryLotOutput].[Year], [qryLotOutput].[LotID], [qryLotOutput].[ProductNo], [qryLotOutput].[LineStator], [qryLotOutput].[SumOfQtyCreated] AS SumOfSumOfQtyCreated, IIf([qryTaken].[SumOfQtyTaken] Is Null,0,[qryTaken].[SumOfQtyTaken]) AS SumOfSumOfQtyTaken, [qryLotOutput].[Model]
FROM qryLotOutput LEFT JOIN qryTaken ON ([qryLotOutput].[ProductNo]=[qryTaken].[ProductNo]) AND ([qryLotOutput].[Year] Like [qryTaken].[Year])
WHERE [qryLotOutput].[Year]=year(now())
ORDER BY [qryLotOutput].[Year];
how to modify it?
thx