Hi,
I need to parse a few different Factories for some fields, in order to update those fields.
Thing is the list of factories is quite large and I don't want to have a bout of code specific to each Factory and each specific fields.
I'd rather have a function that would create any type of Factory, based on a list I provide (or provided with parameter), and do the update on the field (for which I don't need to know the name of the field, but rather the type of the field, but anyway, the fields aren't important in this thread)
So, normally, someone would do: (with BugFactory as an example)
Set theBugFactory = tdc.BugFactory
Now, let say I have a list of Factory I want to parse : (shortened...)
Dim strFactoryArray() As String
strFactoryArray = Split("AssetRelationFactory;AssetRepositoryItemFactory;AttachmentFactory;AuditPropertyFactory", ";")
For intFactoryCount = LBound(strFactoryArray) To UBound(strFactoryArray)
' Here I want to dynamically create a factory object using its object name.
Set theFactory = CreateObject("tdc." & strFactoryArray(intFactoryCount))
...
...
Next
I don't get any error message, however, theFactory seems not to be instantiate with anything. If I put tdc.BugFactory, or any factory there is, it would work.
Gotta admit this would not work anyway...
Set theFactory = CreateObject("tdc.BugFactory")
And this would not compile:
Set theFactory = tdc. & strFactoryArray(intFactoryCount)
So how can I do that with VB?
Thanks for the help!