Below is my code. What I am trying to do is create from one tblAssembly
multiple records into tblWIP.
tblAssembly
WO_NUM ASSEMBLY QTY LABOR_DIFF
2000 5990-100 25 0.25
For every WO you have 4 transactions that occure. I need to create this data
that will eventually be used in an ASCII upload to a legacy application.
tblWIP
ADJ_TYPE WO_NUM COMP_ITEM QTY
K 2000 25
D 2000 6999-96 0.25
D 2000 6999-99 0.25
F 2000 25
This is a command button on my form that is based on the tblAssembly.
Private Sub cmdUpdate_Click()
Dim Db As Database
Dim rs1 As Recordset
Dim rs2 As Recordset
Set Db = CurrentDb
Set rs1 = Db.OpenRecordset("select * from tblAssembly where WO_NUM = " &
"'" & Me.WO_NUM & "'")
Set rs2 = Db.OpenRecordset("select * from tblWIP")
rs1.MoveFirst
While Not rs1.EOF
With rs2
rs2.AddNew
rs2.Fields("ADJ_TYPE") = "K"
rs2.Fields("WO_NUM") = WO_NUM
rs2.Fields("QTY") = QTY
rs2.Update
rs2.AddNew
rs2.Fields("ADJ_TYPE") = "D"
rs2.Fields("WO_NUM") = WO_NUM
rs2.Fields("COMP_ITEM") = "6999-96"
rs2.Fields("QTY") = LABOR_DIFF
rs2.Update
rs2.AddNew
rs2.Fields("ADJ_TYPE") = "D"
rs2.Fields("WO_NUM") = WO_NUM
rs2.Fields("COMP_ITEM") = "6999-99"
rs2.Fields("QTY") = LABOR_DIFF
rs2.Update
rs2.AddNew
rs2.Fields("ADJ_TYPE") = "F"
rs2.Fields("WO_NUM") = WO_NUM
rs2.Fields("QTY") = QTY
rs2.Update
End With
rs1.MoveNext
Wend
Set rs1 = Nothing
Set rs2 = Nothing
End Sub
That error went away and now I have a new one. Type mis-match. Its text for
both. Not sure how it's miss matched.
Er, missing quote and incorrect syntax.
[quoted text clipped - 5 lines]