Hello
I'm using a dictionary object for the first time, and it's behaving rather weirdly. The aim is to add all of the records from a 2 column recordset into the dictionary:
Here's the code:
But the key for the first element (rstActual!SPUD) is 1. For the second element it's 4, so it shouldn't be a duplicate key. I've checked the behaviour carefully, and it is weird.
Any ideas about what the problem could be?
I'm using a dictionary object for the first time, and it's behaving rather weirdly. The aim is to add all of the records from a 2 column recordset into the dictionary:
Here's the code:
There are about 9000 records in the recordset, but I get an error on the 2nd record: Error 457 - This key is already associated with an element of this collection.rstActual.Open strSQL, cnCurrentDb, adOpenStatic, adLockReadOnly
Do Until rstActual.EOF
dict.Add rstActual!SPUD, rstActual!TaxonCountLoop
rstActual.MoveNext
But the key for the first element (rstActual!SPUD) is 1. For the second element it's 4, so it shouldn't be a duplicate key. I've checked the behaviour carefully, and it is weird.
Any ideas about what the problem could be?