L
lisamariechemistry
I'm learning about collections, which I think will be much better
suited to my large project than working with (and constantly
redimming) arrays.
I've created a collection clTestList in one sub that I want to access
from another sub, so I've dutifully declared it publicly.
Some simplified code:
public clTestList as Collection
dim NewTest as clsRecordSet 'classmodule
set clTestList = New Collection
for i = 1 to 10 'not really but I'm simplifying
set NewTest = New clsRecordSet
NewTest.Name = i
clTestList.Add NewTest
next i
for each NewTest in clTestList
debug.print NewTest.Name
next NewTest
Works fine to here, but when I try to loop through the elements of the
collection from another sub, I can't.
I've tried
For Each NewTest in clTestName (with NewTest also declared as public)
For Each Item in clTestName....
For Each clTestName.Item in clTestName...
the error message varies depending upon what I'm trying. What should
I be doing?
suited to my large project than working with (and constantly
redimming) arrays.
I've created a collection clTestList in one sub that I want to access
from another sub, so I've dutifully declared it publicly.
Some simplified code:
public clTestList as Collection
dim NewTest as clsRecordSet 'classmodule
set clTestList = New Collection
for i = 1 to 10 'not really but I'm simplifying
set NewTest = New clsRecordSet
NewTest.Name = i
clTestList.Add NewTest
next i
for each NewTest in clTestList
debug.print NewTest.Name
next NewTest
Works fine to here, but when I try to loop through the elements of the
collection from another sub, I can't.
I've tried
For Each NewTest in clTestName (with NewTest also declared as public)
For Each Item in clTestName....
For Each clTestName.Item in clTestName...
the error message varies depending upon what I'm trying. What should
I be doing?