stevebanks
Programmer
- Mar 30, 2004
- 93
Hi all,
We are currently creating a Weekly Stock Sales an Intake Report. I'm trying to create a stock level forecast. I have created the forecast for demand, returns and cancellations. But I am having a little trouble with the stock level. For example:
¦ itemcode ¦ year ¦ week ¦ stocklevel ¦ demand ¦ returns ¦ cancelled ¦
¦ 1234x ¦ 2006 ¦ 16 ¦ 100 ¦ 20 ¦ 5 ¦ 3 ¦
¦ 1234x ¦ 2006 ¦ 17 ¦ 78 ¦ 12 ¦ 4 ¦ 3 ¦
I'm having trouble trying to get the 100 - 20 + 5 - 3 and end up as the stocklevel in the record after - all the way down the table.
I was thinking of something like this
however after the first record, the stock level is blank so it returns a 0 everytime. If I could update the table every line first, would that do it???
Every little bit of help will be so much appreciated, I'm a little stump.
Hope I've given enough information,
Thanks
Steve
But the trouble is then the
We are currently creating a Weekly Stock Sales an Intake Report. I'm trying to create a stock level forecast. I have created the forecast for demand, returns and cancellations. But I am having a little trouble with the stock level. For example:
¦ itemcode ¦ year ¦ week ¦ stocklevel ¦ demand ¦ returns ¦ cancelled ¦
¦ 1234x ¦ 2006 ¦ 16 ¦ 100 ¦ 20 ¦ 5 ¦ 3 ¦
¦ 1234x ¦ 2006 ¦ 17 ¦ 78 ¦ 12 ¦ 4 ¦ 3 ¦
I'm having trouble trying to get the 100 - 20 + 5 - 3 and end up as the stocklevel in the record after - all the way down the table.
I was thinking of something like this
Code:
SELECT fcast_details.itemcode, fcast_details.Date, fcast_details.[Week No], fcast_details.fcastdemand, fcast_details.fcastreturns, fcast_details.fcastcancellations,IIf([Week No]=1,[fcast_details].[fcaststocklevel],(select fcast_details.fcaststocklevel FROM fcast_details As stlevelfcast where stlevelfcast.[Week No]=((fcast_details.[Week No]-1)) And stlevelfcast.itemcode=fcast_details.itemcode))AS s
FROM fcast_details;
however after the first record, the stock level is blank so it returns a 0 everytime. If I could update the table every line first, would that do it???
Every little bit of help will be so much appreciated, I'm a little stump.
Hope I've given enough information,
Thanks
Steve
But the trouble is then the