M
mattc66 via AccessMonster.com
I am having trouble with the below code - it is stoping on stSQL1 and giving
me the the following message: "No Current Record" Run Time 3201.
What I am trying to do is update the "sfrmOrdersSubform" on those Items that
match in the
"qryICStockPrice_C1" query. Update ListPrice, AvgPrice and etc.
Can anyone offer me a suggestion on what may be wrong with my code?
Thanks
Matt
Private Sub cmdUpdateDisc_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim stSQL1 As String
Set db = CurrentDb()
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Forms![frmOrder]![sfrmOrdersSubform].Form.RecordsetClone
stSQL1 = "Select * From qryICStockPrice_C1 Where Item = " & rs![Item] & "
"
Set rs1 = db.OpenRecordset(stSQL1)
rs.MoveFirst
While Not rs.EOF
With rs
rs.Edit
rs![ListPrice] = Nz(rs2![ListPrice], "")
rs![AvgCost] = Nz(rs2![AvgCost], "")
rs![Multiply] = Nz(rs2![Multiply], "")
rs![AR_CODE] = Nz(rs2![AR_CODE], "")
rs.Update
End With
rs.MoveNext
Wend
Set rs = Nothing
Set rs1 = Nothing
End Sub
me the the following message: "No Current Record" Run Time 3201.
What I am trying to do is update the "sfrmOrdersSubform" on those Items that
match in the
"qryICStockPrice_C1" query. Update ListPrice, AvgPrice and etc.
Can anyone offer me a suggestion on what may be wrong with my code?
Thanks
Matt
Private Sub cmdUpdateDisc_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim stSQL1 As String
Set db = CurrentDb()
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Forms![frmOrder]![sfrmOrdersSubform].Form.RecordsetClone
stSQL1 = "Select * From qryICStockPrice_C1 Where Item = " & rs![Item] & "
"
Set rs1 = db.OpenRecordset(stSQL1)
rs.MoveFirst
While Not rs.EOF
With rs
rs.Edit
rs![ListPrice] = Nz(rs2![ListPrice], "")
rs![AvgCost] = Nz(rs2![AvgCost], "")
rs![Multiply] = Nz(rs2![Multiply], "")
rs![AR_CODE] = Nz(rs2![AR_CODE], "")
rs.Update
End With
rs.MoveNext
Wend
Set rs = Nothing
Set rs1 = Nothing
End Sub