How do I test the return value of a function which returns an object
VB Code:
Public Sub addOrderItem(orderItem As clsOrderItem)
If getOrderItem(orderItem.product) = nothing Then
colOrderItems.Remove orderItem.product
End If
colOrderItems.Add orderItem, orderItem.product
End Sub
Public Function getOrderItem(product As String) As clsOrderItem
On Error GoTo errH
Set getOrderItem = colOrderItems(product)
Exit Function
errH:
Set getOrderItem = Nothing
End Function
how do i test if the getOrderItem function returns nothing (ie if the orderItem isnt in the colOrderItems collection
i figured that would work, but it says "Invalid use of object" and highlights the Nothing keyword