Here is the provided code:
Code: Select all
Sub calcTotal(Event As Object)
Dim Form As Object
Dim Quantity As Object
Dim UnitPrice As Object
Dim Total As Double
Form=Event.Source.Model.Parent
Quantity=Form.GetByName("QUANTITY") REM text box w/ quantity
UnitPrice=Form.GetByName("UNITPRICE") REM text box with price
Total=CInt(Quanity.Text)*CDbl(UnitPrice.Text)
Form.Columns.getByName("TOTAL").updateDouble(Total)
End Sub
Code: Select all
Sub calcPercent(Event As Object)
Dim Form As Object
Dim Attendance As Object REM this is a data column name
Dim RC As Object REM this is a data column name
Dim PERCENT As Double REM this is a data column name
Form=Event.Source.Model.Parent
Attendance=Form.GetByName("Attendance") REM getting a value from form
RC=Form.GetByName("RC") REM getting a value from form
PERCENT=CInt(RC.Text)/CDbl(Attendance.Text)
Form.Columns.getByName("PERCENT").updateDouble(PERCENT)
End Sub
Any suggestions as what the problem is?
Additional questions:
1. The fields in my table are of the "decimal" type, does that mean that I should replace ".text" with ".decimal" in the equation line?
2. Do I use a "/" to indicate a division operation on the equation line?