Mission: Pass the calculated values from qryBomMaterialsAddParts2.[IncreaseBy] into tblBomMaterials.AssemblyAdds
There can be 0 to 25 or more records involved in the record set to update.
Query 2 provides the recordset needed to update.
Query 3 should update the table, but does not.
Query1 qryBomMaterialsAddParts (Gets the filter criteria [VersionG], [Ln2] and the value to pass [AddForFallout])
SELECT qryBomMaterialsAssem.VersionG, qryBomMaterialsAssem.BomLineId, qryBomMaterialsAssem.LN, Int([LN]) AS Ln2, qryBomMaterialsAssem.ItemType, qryBomMaterialsAssem.AddForFallout, qryBomMaterialsAssem.SubTotal
FROM qryBomMaterialsAssem
WHERE (((qryBomMaterialsAssem.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND ((Int([LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((qryBomMaterialsAssem.Qty)>0));
Query 2 qryBomMaterialsAddParts2 (Selects the Record Set to update)
SELECT tblBomMaterials.BomLineId, tblBomMaterials.VersionG, tblItems.ItemType, tblBomMaterials.LN, Int([tblBomMaterials].[LN]) AS Family, tblBomMaterials.Qty, IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0) AS IsTopLevel, DLookUp("AddForFallout","QryBomMaterialsAddParts") AS AFF, [Qty]*[AFF] AS IncreaseBy
FROM tblBomMaterials LEFT JOIN tblItems ON tblBomMaterials.ItemNo = tblItems.ItemID
WHERE (((tblBomMaterials.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND
((Int([tblBomMaterials].[LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((tblBomMaterials.Qty)>0) AND
((IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0))=1));
Query 3 qryBomMaterialsAddParts3 (Should Update records selected in Query 2 (tblBomMaterials.AssemblyAdds)with the value in [IncreaseBy])
UPDATE tblBomMaterials SET tblBomMaterials.AssemblyAdds = qryBomMaterialsAddParts2.IncreaseBy
WHERE (((tblBomMaterials.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND ((Int([tblBomMaterials].[LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((tblBomMaterials.Qty)>0) AND ((IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0))=1));
The Problem:
Query 3 produces the correct number of records but the fields are all blank, and also runs with out a warning even though warnings are set and passes no values to the table.
Thanks,
UncleG
There can be 0 to 25 or more records involved in the record set to update.
Query 2 provides the recordset needed to update.
Query 3 should update the table, but does not.
Query1 qryBomMaterialsAddParts (Gets the filter criteria [VersionG], [Ln2] and the value to pass [AddForFallout])
SELECT qryBomMaterialsAssem.VersionG, qryBomMaterialsAssem.BomLineId, qryBomMaterialsAssem.LN, Int([LN]) AS Ln2, qryBomMaterialsAssem.ItemType, qryBomMaterialsAssem.AddForFallout, qryBomMaterialsAssem.SubTotal
FROM qryBomMaterialsAssem
WHERE (((qryBomMaterialsAssem.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND ((Int([LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((qryBomMaterialsAssem.Qty)>0));
Query 2 qryBomMaterialsAddParts2 (Selects the Record Set to update)
SELECT tblBomMaterials.BomLineId, tblBomMaterials.VersionG, tblItems.ItemType, tblBomMaterials.LN, Int([tblBomMaterials].[LN]) AS Family, tblBomMaterials.Qty, IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0) AS IsTopLevel, DLookUp("AddForFallout","QryBomMaterialsAddParts") AS AFF, [Qty]*[AFF] AS IncreaseBy
FROM tblBomMaterials LEFT JOIN tblItems ON tblBomMaterials.ItemNo = tblItems.ItemID
WHERE (((tblBomMaterials.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND
((Int([tblBomMaterials].[LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((tblBomMaterials.Qty)>0) AND
((IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0))=1));
Query 3 qryBomMaterialsAddParts3 (Should Update records selected in Query 2 (tblBomMaterials.AssemblyAdds)with the value in [IncreaseBy])
UPDATE tblBomMaterials SET tblBomMaterials.AssemblyAdds = qryBomMaterialsAddParts2.IncreaseBy
WHERE (((tblBomMaterials.VersionG)=[Forms].[frmBom].[Form]![VersionG]) AND ((Int([tblBomMaterials].[LN]))=Int([Forms].[frmBom].[Form].[frmBomMaterialsAssem]![LN])) AND ((tblBomMaterials.Qty)>0) AND ((IIf(([tblBomMaterials].[LN])=([tblBomMaterials].[LN]/1),1,0))=1));
The Problem:
Query 3 produces the correct number of records but the fields are all blank, and also runs with out a warning even though warnings are set and passes no values to the table.
Thanks,
UncleG