BobBridges
Active Member
Here's an odd one that I fear might be a bug in in the VBE itself. I have a collection of objects, and I have a loop that looks at the collection and selects some of them to put in another collection, like this:
This past spring it worked fine. Now it works until the 243rd item of the ADMgrs collection; after adding that one to the new collection, the Loop-Until-False statement loops back around and starts the Do block again!, resulting in an infinite loop.
I added an extra test after the spring run, but a) I don't remember which one, and anyway b) I can't imagine how anything could cause that particular behavior. Any ideas, anyone...please?
Code:
For Each omgr In ADMgrs
vk = omgr.Manager.ID
Do 'block
If Not Exists(osus, vk, osu) Then Exit Do 'if he's not in the osus collection, I'll select him
If Not osu.bAgent Then GoTo IterateMgr 'if he's in osus I still don't want him if he's not an agent
If Not osu.bASO Then GoTo IterateMgr 'if he's in osus and an agent I still don't want him if he's not ASO
Loop Until False
of.Add omgr, vk
IterateMgr:
Next omgr
I added an extra test after the spring run, but a) I don't remember which one, and anyway b) I can't imagine how anything could cause that particular behavior. Any ideas, anyone...please?