Using collection.Item("key")
Hi David:
Quote:
>e.g.
>SET OBJ = COLLECTION.ITEM("MissingKey")
>returns the catch all error 5 , not much use.
You will have to trap the error.
Quote:
>I really want to be able to do this
>IF COLLECTION.ITEMEXISTS("MissingKey") THEN
> SET OBJ = COLLECTION.ITEM("MissingKey")
>END IF
Just "roll your own" function, i.e.
Public Function ItemExists(col As Collection, ByVal Key As String) As
Boolean
Dim vTest As Variant
On Error Goto ErrItemExits
vTest = col(Key)
'If code reaches here then item exits
ItemExists = True
Exit Function
ErrItemExits:
ItemExists = False
End Function
NOTE: The above is untested code written off the top of my head ;)
Hope this helps,
Doug.