I have this code to drop a recordset in an array:
I get overflows, I think because some fields in the Access query result in #Error. It would really make my life easy if I could catch it as it's going into the array and set it to Empty.
I tried with the IsError(rst(c-1)) and IsError(TempArray(r, c) = rst(c - 1)). Neither of those approaches worked.
Is there a better way to catch the overflow and set it to an empty cell?
Code:
For r = 1 To rst.RecordCount
For c = 1 To rst.Fields.Count
If IsNull(rst(c - 1)) Or IsError(TempArray(r, c) = rst(c - 1)) Then
TempArray(r, c) = Empty
Else
TempArray(r, c) = rst(c - 1)
End If
Next
rst.MoveNext
I tried with the IsError(rst(c-1)) and IsError(TempArray(r, c) = rst(c - 1)). Neither of those approaches worked.
Is there a better way to catch the overflow and set it to an empty cell?