I have an orders form with a subform that shows the individual products for the specific order. I am trying to make a button that you can click on to update or change the pricing from what it is currently to the new price (in case it needs updated so I don't need to go throug each one). I have put together some code from things I have read here. It seems to work, but it changes (or updates) the pricing for every order and not just the order I am on. If someone can let me know where I am going wrong, or if I am aproaching it in the wrong way, how to do it?
Thanks
Code:
Dim rstO As DAO.Recordset
Dim rstT As DAO.Recordset
Set rstT = Me.Order_Details_Subform.Form.RecordsetClone
Set rstO = CurrentDb.OpenRecordset("Order Details")
If rstT.RecordCount > 0 Then
rstO.MoveFirst
Do Until rstO.EOF
rstO.Edit
rstO!PriceLevel = "MSRP"
rstO!UnitPrice = Nz(DLookup("MSRP", "Products", "ProductID = " & rstO!ProductID), 0)
rstO.Update
rstO.MoveNext
Loop
End If
rstT.Close
rstO.Close
Set rstT = Nothing
Set rstO = Nothing
Me.Order_Details_Subform.Requery
Thanks