Hi,
I can not understand why this code will not work. Could anyone help??
Public Function AddValues1(value1 As Double, value2 As Double) As Double
If IsNull(value1) Then
AddValues1 = value2
ElseIf IsNull(value2) Then
AddValues1 = value1
End If
AddValues1 = value1 + value2
End Function
What it should do is add 2 fields together, but if 1 of the fields is empty it should return the value of the other populated field, but I simply get the message #Error in the field. If both fields are populated it works!!
TIA
Steven
I can not understand why this code will not work. Could anyone help??
Public Function AddValues1(value1 As Double, value2 As Double) As Double
If IsNull(value1) Then
AddValues1 = value2
ElseIf IsNull(value2) Then
AddValues1 = value1
End If
AddValues1 = value1 + value2
End Function
What it should do is add 2 fields together, but if 1 of the fields is empty it should return the value of the other populated field, but I simply get the message #Error in the field. If both fields are populated it works!!
TIA
Steven