Sudhir Prabhu
Member
Hello all,
Unable to get through a "BeforeUpdate" procedure for a field that is calculated in vb form.
The user form has three amount fields (user entered) - txtAmount01, txtAmount02, txtAmount03. The realtime summation of these three is expected to be updated in field "txtGross". Reason for using "BeforeUpdate" - so that the txtGross field updates real-time as and when the user enters amounts in each of the three fields.
The code below is not going through, with error as "Procedure declaration does not match description event or procedure having same name". I have ensured that there is no other procedure with similar name.
Where am I going wrong ? Appreciate support, Thanks!
Unable to get through a "BeforeUpdate" procedure for a field that is calculated in vb form.
The user form has three amount fields (user entered) - txtAmount01, txtAmount02, txtAmount03. The realtime summation of these three is expected to be updated in field "txtGross". Reason for using "BeforeUpdate" - so that the txtGross field updates real-time as and when the user enters amounts in each of the three fields.
The code below is not going through, with error as "Procedure declaration does not match description event or procedure having same name". I have ensured that there is no other procedure with similar name.
Where am I going wrong ? Appreciate support, Thanks!
Code:
Private Sub txtGross_BeforeUpdate(Calculate As Double)
If (Not IsNull("txtAmount01")) Then
txtGross.Text = Val(txtAmount01.Text) + Val(txtAmount02.Text) + Val(txtAmount03.Text)
Else
MsgBox ("At least one amount must be more than zero")
End If
Calculate = True
Me.txtGross.Value = Format(Me.txtGross.Value, "#,##,##0.00")
End Sub