Naomi --
This is the only place that oCalcFolders is updated in any fashion.
How do you suggest I check again? What am I missing? If the result from GetKey is zero (my second statement), doesn't that mean that the key does not exist? How could it suddenly exist a few lines later, and what different check would I use then?
>>I have a simple collection named oCalcFolders, which is referenced in the code below.
>>
>>This is the
only place that the collection is touched.
>>
>>How can I get error 2062," The specified Key already exists" on the next to last line? Doesn't the earlier call to 'GetKey' return a result that indicates whether the key already exists?
>>
lcFolder = Trim (loTableInfo.Folder)
>>lnIndex = This.oCalcFolders.GetKey (lcFolder)
>>If lnIndex # 0
>> lcCalcFolder = This.oCalcFolders (lnIndex)
>>Else
>> lcCalcFolder = GetOtherCalcDirectory (Left (lcFolder, At ('\', lcFolder) - 1))
>> This.oCalcFolders.Add (lcCalcFolder, lcFolder)
>>Endif
>
>You can check again before calling Add method. Who knows what did you get into lcCalcFolder now and whether this key already exists or not.
Jim Nelson
Newbury Park, CA