Hi
Say I have declared a type:
Type employee
empNum as long
Name as string
End Type
And then I have an array of the type
Dim employeeList() as employee
Now here is the problem - I have a routine that iterates through the array, and it is crashing when it tries to UBound(employeeList) and the array has not yet been assigned to.
Is there a way to check for this ? I tried "If employeeList is nothing", but that tells me 'Type Mismatch'
I also tried IsEmpty(employeeList) but that just gave me a completely confusing message ... "Only user-defined types defined in public object models can be coerced to or from a variant or passed to late-bound functions" ... ??
In the end, this is the only thing I could get to work:
Err.Clear
On Error Resume Next
i = UBound(employeeList)
If Err.Number > 0 Then
SearchCache = False
Exit Function
End If
On Error GoTo 0
TIA
Orekin
Say I have declared a type:
Type employee
empNum as long
Name as string
End Type
And then I have an array of the type
Dim employeeList() as employee
Now here is the problem - I have a routine that iterates through the array, and it is crashing when it tries to UBound(employeeList) and the array has not yet been assigned to.
Is there a way to check for this ? I tried "If employeeList is nothing", but that tells me 'Type Mismatch'
I also tried IsEmpty(employeeList) but that just gave me a completely confusing message ... "Only user-defined types defined in public object models can be coerced to or from a variant or passed to late-bound functions" ... ??
In the end, this is the only thing I could get to work:
Err.Clear
On Error Resume Next
i = UBound(employeeList)
If Err.Number > 0 Then
SearchCache = False
Exit Function
End If
On Error GoTo 0
TIA
Orekin