LaughingDev
New Member
- Joined
- Sep 12, 2011
- Messages
- 12
Hi,
I am working on a system which manages orders, purchases and the inventory for a small trading company, much like the northwind example.
The db currently has 6 tables: Products, Customers, Orders, OrderDetails, Purchases and PurchaseDetails.
There are three queries which are being used to keep track of the StockOnHand, one which sums the total QtyPurchased, anther for total QtySold and the third which uses the first two to calculate QtyAvailable.
I am currently working on the inventory/stock reports and would like to have them filtered by date, so that it would produce the stats for the last week, month, quarter and year. Ideally using one report and having it filtered from a Form from which users can select the desired period via a ComboBox.
I am having trouble getting this to work, what Ive tried is to use the OrderDate field from the Orders table in the QtySold query but then the results of the query cease to give the correct sum as it is being groupedby the OrderDate field. So I tried setting it to WHERE instead of GROUPBY and gave it the following criteria:
>= DateAdd("d",-[period],date())
where I intended to pass the value for [period] from a form on which users could select the desired period (wk, mnth, qtr, year). However I am unsure about how I would do this.
I think Im going about it completely wrong, and would thus appreciate any advice/instructions which could help me acheive this functionality.
Thanks in advance.
I am working on a system which manages orders, purchases and the inventory for a small trading company, much like the northwind example.
The db currently has 6 tables: Products, Customers, Orders, OrderDetails, Purchases and PurchaseDetails.
There are three queries which are being used to keep track of the StockOnHand, one which sums the total QtyPurchased, anther for total QtySold and the third which uses the first two to calculate QtyAvailable.
I am currently working on the inventory/stock reports and would like to have them filtered by date, so that it would produce the stats for the last week, month, quarter and year. Ideally using one report and having it filtered from a Form from which users can select the desired period via a ComboBox.
I am having trouble getting this to work, what Ive tried is to use the OrderDate field from the Orders table in the QtySold query but then the results of the query cease to give the correct sum as it is being groupedby the OrderDate field. So I tried setting it to WHERE instead of GROUPBY and gave it the following criteria:
>= DateAdd("d",-[period],date())
where I intended to pass the value for [period] from a form on which users could select the desired period (wk, mnth, qtr, year). However I am unsure about how I would do this.
I think Im going about it completely wrong, and would thus appreciate any advice/instructions which could help me acheive this functionality.
Thanks in advance.