I use the code below on a report. The code works fine as long as a value is enter in any of the fields [24 Hrs],[48 Hrs],[72 Hrs],[1 Week],[More Than 1 Week]. If there is no value it gives me this debug error. “Run time error 13” , Type mismatch. Is there a way I can modify this so that it can handle the null values? Thanks…
Private Sub Report_Activate()
Dim var24Hrs As Integer
Dim var48Hrs As Integer
Dim var72Hrs As Integer
Dim var1Wk As Integer
Dim varMoreThan1Wk As Integer
var24Hrs = IIf(IsNull([24 Hrs]), 0, [24 Hrs])
var48Hrs = IIf(IsNull([48 Hrs]), 0, [48 Hrs])
var72Hrs = IIf(IsNull([72 Hrs]), 0, [72 Hrs])
var1Wk = IIf(IsNull([1 Week]), 0, [1 Week])
varMoreThan1Wk = IIf(IsNull([More Than 1 Week]), 0, [More Than 1 Week])
[24 Hrs] = [EIR Total] – var48Hrs – var72Hrs – var1Wk – varMoreThan1Wk
End Sub