I'm trying to copy the data that's in a group of fields into another field in a different table, but I'm not too savvy with VBA. This is the VBA someone recommended, but not sure why it's not working.
Basically;
I have one table (tblParts) that has a field (Price). I want to take the sum of all the Price fields (linked together by an (Invoice_Link) field), then supply that total into the (Parts_Total) field in another table (tblInvoice). The two tables are joined by the (Invoice_Link) field in one table and the (ID#) field in the other table which are the same number.
Why doesn't this work?
Private Sub Price_Change()
Dim MyRe As DAO.Recordset, MyDb As DAO.Database
Set MyDb = CurrentDb
Set MyRe = MyDb.openrecordsource("Select * from tblParts where Invoice_Link=" & Me!ID#)
MyRe.Edit
MyRe!Price = Me!Parts_Total$
MyRe.Update
End Sub
Basically;
I have one table (tblParts) that has a field (Price). I want to take the sum of all the Price fields (linked together by an (Invoice_Link) field), then supply that total into the (Parts_Total) field in another table (tblInvoice). The two tables are joined by the (Invoice_Link) field in one table and the (ID#) field in the other table which are the same number.
Why doesn't this work?
Private Sub Price_Change()
Dim MyRe As DAO.Recordset, MyDb As DAO.Database
Set MyDb = CurrentDb
Set MyRe = MyDb.openrecordsource("Select * from tblParts where Invoice_Link=" & Me!ID#)
MyRe.Edit
MyRe!Price = Me!Parts_Total$
MyRe.Update
End Sub