This is all about bill of materials on parts.. The problem I’ve hit is when a child part has its own bill of materials I need to transfer it to the top level part
In the below code… I’ve selected everything needed, the recordset count holds the correct amount of records, it loops through assigning the correct values to the variables for each record.
The problem is the RqPrtNum & RqPrtLnk variables don’t insert there values into the table in the INSERT INTO. They hold the correct value but instead I get a pop up asking me what the value is…
strSQL2 = "SELECT tbl_BOM_Requirments.PrtNmber_LinkField, tbl_BOM_Requirments.RequiredMaterialPrtNum, tbl_BOM_Requirments.RequiredMaterialDescription, tbl_BOM_Requirments.ReqrdQty, tbl_BOM_Requirments.MstrBomFreeIssue, tbl_BOM_Requirments.MstrBomPlySize, tbl_BOM_Requirments.MstrBomPlyQty, tbl_BOM_Requirments.MstrBomUnitCost, tbl_BOM_Requirments.MstrBomTotalPrice, tbl_BOM_Requirments.MstrBomPlyTotal " & vbCrLf & _
"FROM tbl_BOM_Requirments " & vbCrLf & _
"WHERE (((tbl_BOM_Requirments.PrtNmber_LinkField)=""PRT1229""));"
Set rs = db.OpenRecordset(strSQL2)
With rs
If rs.EOF Then
FindRecordCount = 0
Else
rs.MoveLast
FindRecordCount = rs.RecordCount
rs.MoveFirst
End If
Do Until rs.EOF
If Not rs.EOF Then
RqPrtNum = rs![RequiredMaterialPrtNum]
RqPrtLnk = rs![PrtNmber_LinkField]
DoCmd.RunSQL "INSERT INTO Tbl_BOM_Requirments ([RequiredMaterialPrtNum],[PrtNmber_LinkField]) VALUES( RqPrtNum , RqPrtLnk )"
End If
rs.MoveNext
Loop
End With
Any ideas why when RqPrtNum & RqPrtLnk are being watched the values are correct but there not being inserted into the table ?
If I key the value into the pop up it inserts into the table..