TheEvilSam
Registered User.
- Local time
- Today, 12:39
- Joined
- Jan 23, 2012
- Messages
- 13
so I have a number of table in my access database. one of the tables is called "tblCurrentSale" and another is called "TblDraughtStock"
The current sales table has the following layout
CurrSaleID| DraughtID| SpiritID| SoftDrinkID| BottleID| Item__| SalePrice|
22_______|________1|_______|__________|_________|Clsbrg|_____2.70|
23_______|________1|_______|__________|_________|Clsbrg|_____2.70|
24_______|________1|_______|__________|_________|Clsbrg|_____2.70|
25_______|________1|_______|__________|_________|Clsbrg|_____2.70|
TblDraughtStock looks as follows
DraughtStockID | DraughtID | Item | Stock| MinLevelStock |
____________1_|_______1_|Clsbrg_|5000_|________500__|
____________2_|_______3_|Crling_|5000_|________500__|
____________3_|_______6_|__IPA_|5000_|________500__|
____________4_|_______7_|Wrthy_|5000_|________500__|
I need some VBA or SQL that will subtract 1 from the stock column in "TblDraughtStock" when the draughtID is the same in both "tblcurrentsale" and "tblDraughtStock" ie, in the example above, on clicking the complete sale button 4 would be minused form the stock column of the "TblDraughtStock" where Draught ID = 1 giving the new table
DraughtStockID | DraughtID | Item | Stock| MinLevelStock |
____________1_|_______1_|Clsbrg_|4996_|________500__|
____________2_|_______3_|Crling_|5000_|________500__|
____________3_|_______6_|__IPA_|5000_|________500__|
____________4_|_______7_|Wrthy_|5000_|________500__|
Any help would be appreciated. Further info if needed can be given.
Thanks
Sam
The current sales table has the following layout
CurrSaleID| DraughtID| SpiritID| SoftDrinkID| BottleID| Item__| SalePrice|
22_______|________1|_______|__________|_________|Clsbrg|_____2.70|
23_______|________1|_______|__________|_________|Clsbrg|_____2.70|
24_______|________1|_______|__________|_________|Clsbrg|_____2.70|
25_______|________1|_______|__________|_________|Clsbrg|_____2.70|
TblDraughtStock looks as follows
DraughtStockID | DraughtID | Item | Stock| MinLevelStock |
____________1_|_______1_|Clsbrg_|5000_|________500__|
____________2_|_______3_|Crling_|5000_|________500__|
____________3_|_______6_|__IPA_|5000_|________500__|
____________4_|_______7_|Wrthy_|5000_|________500__|
I need some VBA or SQL that will subtract 1 from the stock column in "TblDraughtStock" when the draughtID is the same in both "tblcurrentsale" and "tblDraughtStock" ie, in the example above, on clicking the complete sale button 4 would be minused form the stock column of the "TblDraughtStock" where Draught ID = 1 giving the new table
DraughtStockID | DraughtID | Item | Stock| MinLevelStock |
____________1_|_______1_|Clsbrg_|4996_|________500__|
____________2_|_______3_|Crling_|5000_|________500__|
____________3_|_______6_|__IPA_|5000_|________500__|
____________4_|_______7_|Wrthy_|5000_|________500__|
Any help would be appreciated. Further info if needed can be given.
Thanks
Sam