I have a form called : tblINVOICE which contains a field called PRICERATIO. I also have a subform called : tblINVOICEDETAIL Subform with fields called PURCHASEWEIGHT, PRICE, BOATPRICE, and AMOUNT.
I have written this code(below) to calculate what the BOATPRICE and AMOUNT's are for each record in the subform, but I get an error saying : Compile Error: method or data member not found. Also, the .Edit is highlighted when the error message box appears. I can't determine what the problem is.
Private Sub Command33_Click()
Dim blah As Double
Dim rst As Recordset
Set rst = Me.tblINVOICEDETAIL_Subform.Form.RecordsetClone
If rst.RecordCount > 0 Then
With rst
.MoveFirst
While Not .EOF
.Edit
.Fields("PRICE") = .Fields("BOATPRICE") * Form_tblINVOICE.PRICERATIO
.Fields("AMOUNT") = .Fields("PRICE") * .Fields("PURCHASEWEIGHT")
.update
.MoveNext
Wend
End With
Else
'no records found
End If
rst.Close
rst = Nothing
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub
I have written this code(below) to calculate what the BOATPRICE and AMOUNT's are for each record in the subform, but I get an error saying : Compile Error: method or data member not found. Also, the .Edit is highlighted when the error message box appears. I can't determine what the problem is.
Private Sub Command33_Click()
Dim blah As Double
Dim rst As Recordset
Set rst = Me.tblINVOICEDETAIL_Subform.Form.RecordsetClone
If rst.RecordCount > 0 Then
With rst
.MoveFirst
While Not .EOF
.Edit
.Fields("PRICE") = .Fields("BOATPRICE") * Form_tblINVOICE.PRICERATIO
.Fields("AMOUNT") = .Fields("PRICE") * .Fields("PURCHASEWEIGHT")
.update
.MoveNext
Wend
End With
Else
'no records found
End If
rst.Close
rst = Nothing
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
End Sub