VB Code:
  1. Public Sub addOrderItem(orderItem As clsOrderItem)
  2.     If getOrderItem(orderItem.product) = nothing Then
  3.         colOrderItems.Remove orderItem.product
  4.     End If
  5.     colOrderItems.Add orderItem, orderItem.product
  6. End Sub
  7.  
  8. Public Function getOrderItem(product As String) As clsOrderItem
  9.     On Error GoTo errH
  10.     Set getOrderItem = colOrderItems(product)
  11.     Exit Function
  12. errH:
  13.     Set getOrderItem = Nothing
  14. 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