Hi all, I'm new to the forums and this is my first post. I have searched these forums in hopes to find a solution to this issue but haven't come across it yet.
I have a form "Cost Sheet" thats linked to its respective table. I have about 2700 records and calculated fields do not save to the table ( I know why, and i know its bad practice to save calculated info to your table but it's strickly through a test database).
I wan't to be able to click the button on the form > have it loop through all the records > and assign data from the calculated fields in the form to the "Cost Sheet" table.
Here's what i have so far, I don't get any errors but it's not changing anything in the table after i click.
Code:
Private Sub updateRecords_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM [COST SHEET]")
If Not rs.EOF Then rs.MoveFirst
Do Until rs.EOF
rs.Edit
packTotalField1 = Text364
packTotalField2 = Text366
packTotalField3 = Text367
packTotalField4 = Text368
finalSubField1 = SUB_TOTAL_1
finalSubField2 = SUB_TOTAL_2
finalSubField3 = SUB_TOTAL_3
finalSubField4 = SUB_TOTAL_4
laborSubField1 = SUB_TOTAL1
laborSubField2 = SUB_TOTAL2
laborSubField3 = SUB_TOTAL3
laborSubField4 = SUB_TOTAL4
matSubTotal1 = MATERIAL_SUB_TOTAL1
matSubTotal2 = MATERIAL_SUB_TOTAL2
matSubTotal3 = MATERIAL_SUB_TOTAL3
matSubTotal4 = MATERIAL_SUB_TOTAL4
subletSubTotal1 = SUBLET_SUB_TOTAL1
subletSubTotal2 = SUBLET_SUB_TOTAL2
subletSubTotal3 = SUBLET_SUB_TOTAL3
subletSubTotal4 = SUBLET_SUB_TOTAL4
totalPerPiece1 = TOTAL_PER_PIECE_1
totalPerPiece2 = TOTAL_PER_PIECE_2
totalPerPiece3 = TOTAL_PER_PIECE_3
totalPerPiece4 = TOTAL_PER_PIECE_4
rs.Update
rs.MoveNext
Loop
End Sub
Any tips would be much appreciated.
/EDIT
Ok what it's actually doing is when i click this button, only the record i currently have selected in the form is getting updated. I need this to loop through all 2700 and update, any suggestions?