Hi Vlad
Changed the Code to the following but now get the attached error.
Code:
Private Sub cmdUpdate_Click()
10 On Error GoTo cmdUpdate_Click_Error
Dim strSQL As String
20 If Me.Dirty Then Me.Dirty = False
Dim rs As DAO.Recordset 'Object
30 Set rs = Forms!frmPurchaseDates!frmPurchasedItemssubform.Form.RecordsetClone 'Vlad assumes the subform control has the same name as its source object; your original expression would work as the form is not actually open as a stand alone form
40 With rs
50 Do While Not .EOF
'Do Something
60 strSQL = "UPDATE [tblStock] SET InvQtyOH = " & Nz(rs("Qty"), 0) + Nz(rs("InvQtyOH"), 0) & " WHERE StockID = " & rs("StockID") & ";"
70 Debug.Print strSQL
80 CurrentDb.Execute strSQL, dbFailOnError
90 .MoveNext
100 Loop
110 End With
120 rs.Close
130 Set rs = Nothing
140 MsgBox "All Stock Updated", vbInformation
150 On Error GoTo 0
160 Exit Sub
cmdUpdate_Click_Error:
170 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdUpdate_Click, line " & Erl & "."
End Sub