Here is some sample Code, may be helpful to correct yours:
DoCmd.Hourglass True
Set db = CurrentDb
Set rst = db.OpenRecordset("Order Details", dbOpenDynaset)
rst.MoveLast
TotalRecords = rst.RecordCount
rst.MoveFirst
Do While Not rst.EOF
With rst
Quantity = ![Quantity]
UnitRate =...