I have a product table which hold products for six warehouses. The business rule here says each of the six warehouses must have the same products name, but the difference should be the primary key or differentiated by the primary key. The reason being each warehouse represents a branch listed as below:
(1) 001
(2) 002
(3) 003
(4) 004
(5) 005
(6) 006
Now when a new product is created in branch 001, we need that new product to be pasted or replicated in all branches as below:
(1) 002 =======> Branch 002
(2) 003 =======> Branch 003
(3) 004 =======> Branch 004
(4) 005 =======> Branch 005
(5) 006 =======> Branch 006
So, in short, the appending query must append line 1 for 001, line 2 for 002, line 3 as 003-line 4 004 line 5 as 005 and Line 6 as 006 same newly created product, let us say created in 001 must be replicated in 002,003,004,005 and 006.
The below query can only do that replication one branch at a time, but users want it to be doing in all the branches at one run.
(1) 001
(2) 002
(3) 003
(4) 004
(5) 005
(6) 006
Now when a new product is created in branch 001, we need that new product to be pasted or replicated in all branches as below:
(1) 002 =======> Branch 002
(2) 003 =======> Branch 003
(3) 004 =======> Branch 004
(4) 005 =======> Branch 005
(5) 006 =======> Branch 006
So, in short, the appending query must append line 1 for 001, line 2 for 002, line 3 as 003-line 4 004 line 5 as 005 and Line 6 as 006 same newly created product, let us say created in 001 must be replicated in 002,003,004,005 and 006.
The below query can only do that replication one branch at a time, but users want it to be doing in all the branches at one run.
Code:
INSERT INTO tblProducts ( WHID, ItemID, ProductName, ReorderLevel, CountryOrigin, QuantityUnit, ProductType, PackageNet, Barcode, dftPrc, Codeclassification, itemClsCd, Sales, UOM, TPIN, bhfId, itemCd, itemTyCd, CountryCode, orgnNatCd, qtyUnitCd, btchNo, isrcAplcbYn, useYn, regrNm, regrId, modrNm, SupplierTPIN, specialCode, TaxClass, vatCatCd, TourismClass, taxAmtTl, PackageNetCode, pkgUnitCd, modrId )
SELECT [Forms]![frmProducts]![boBranchPKID] AS WHIDss, tblProducts.ItemID, tblProducts.ProductName, tblProducts.ReorderLevel, tblProducts.CountryOrigin, tblProducts.QuantityUnit, tblProducts.ProductType, tblProducts.PackageNet, tblProducts.Barcode, tblProducts.dftPrc, tblProducts.Codeclassification, tblProducts.itemClsCd, tblProducts.Sales, tblProducts.UOM, tblProducts.TPIN, [Forms]![frmProducts]![CboBranchesAdding] AS bhfIds, tblProducts.itemCd, tblProducts.itemTyCd, tblProducts.CountryCode, tblProducts.orgnNatCd, tblProducts.qtyUnitCd, tblProducts.btchNo, tblProducts.isrcAplcbYn, tblProducts.useYn, tblProducts.regrNm, tblProducts.regrId, tblProducts.modrNm, tblProducts.SupplierTPIN, tblProducts.specialCode, tblProducts.TaxClass, tblProducts.vatCatCd, tblProducts.TourismClass, tblProducts.taxAmtTl, tblProducts.PackageNetCode, tblProducts.pkgUnitCd, tblProducts.modrId
FROM tblProducts
WHERE (((tblProducts.ProductID)=[Forms]![frmProducts]![CboItemsAddToBranches]));