Hi all,
It's late Friday, I am mentally exhausted, and cannot function correctly and work this one out. It's an inherited database, so not responsible for how things are currently set out, just trying to fix. Simple complicated scenario below:
TblTmpBarSales has one field (StockID) and only ever one entry at any one time
TblStockLink has three fields (StockID,StockLinkID, StockLink)
TblStockFix has two fields, StockID, Qty (default = 1)
Problem is this, when a sale is made in the bar of Jack Daniels and Coke, it affects the stock levels of two items - the JD and the Coke supply. The further problem is that the StockID in TblTmpBarSales does NOT relate to the StockID in TblStock, hence the intermediary TblStockLink.
Here's what I am trying to achieve:
TblTmpBarSales.StockID ("JD_COKE") = TblStockLink.StockLink
TblStockLink has two corresponding entries:
StockID StockLinkID Stocklink
JD.............. 1........ JD_COKE
COKE.......... 2........ JD_COKE
I'd like if someone could help me with a Do...Loop to Take the StockID from TblTmpBarSales, look for the corresponding StockLink in TblStockLink, then append the TblStockLink.StockID to TblStockFix - and do it for every occasion of Stocklink in TblStockLink which in this case is two (one for JD, one for Coke)
I can then rework the correct TblStock free stock level from the information written in TblStockFix.
Is that clear? After all it is beer o'clock and things are starting to get fuzzy. Sorry if it sounds clunky, but feel sure someone will work out what I need by way of VBA code
cheers
Pete