Hi All,
This is the function i'm using for summing a listbox column:
Function TonSum() As Variant
Dim I As Integer, J As Integer, ctl As Control
Set ctl = Me.lstDrivera2
J = ctl.ListCount - 1
TonSum = 0
For I = 1 To J
TonSum = TonSum + ctl.Column(8, I)
Next I
End Function
The problem i have is if one the records in the listbox doesn't have a value (is null) then Access gives me a 'Type Mismatch' error. Can anyone suggest how to treat the null value so it excludes it from the sum?
This is the function i'm using for summing a listbox column:
Function TonSum() As Variant
Dim I As Integer, J As Integer, ctl As Control
Set ctl = Me.lstDrivera2
J = ctl.ListCount - 1
TonSum = 0
For I = 1 To J
TonSum = TonSum + ctl.Column(8, I)
Next I
End Function
The problem i have is if one the records in the listbox doesn't have a value (is null) then Access gives me a 'Type Mismatch' error. Can anyone suggest how to treat the null value so it excludes it from the sum?