I have a class module in an Excel project that has a property called Marks, this is a VB Collection and has a public get property (but no set or let).
I can assign values to this without any problem:
myObject.Marks.Add 3.14159
However, when I try to do something with this object (e.g., iterating through it), I get an error:
3021: Either BOF or EOF is true or the current record has been deleted
However, if I try myObject.Marks.Count, it shows that the collection contains the amount of data that I was expecting… I just can’t access it!
I don’t really understand why. I am using the same process with other collection properties within the object — even collections of collections — and they’re working fine.
Any ideas?
myObject.myCollection.Add recordset!fieldadds the recordset field object to themyCollectionobject, rather than its value. As such, simply casting the field to its appropriate type solves the problem.