Help! Pulling my hair out 6pm Friday!! - Can you help me?
I have a collection which is a series of objects. They contain some information containing an identifer (deal number) and a date. I want to remove some based on a date specified. for example, remove all deals that are before April.
in the example I have
Deal Number Date
I did have this bit of code
If cDealDetail.StartDate < plngStartDate Then
Which when I had the following code in the remove section of the collection
Public Sub Remove(vntIndexKey As Variant)
'used when removing an element from the collection
'vntIndexKey contains either the Index or Key, which is why
'it is declared as a Variant
I thought that this would work a treat, but of course (d'oh) the index changes as the objects removed. So it works fine for dealnumber 1, but after this is removed, the index of deal number 2 is now 1, and therefore it deletes the wrong one!
Anyone got any ideas how I would code this is a different (ie working) way!!
Thank you so much