J
J Streger
I have a three tiered Class modules Set up:
clsEVM contains a collection of clsMonths which contains a collection of
clsWBSIDs
In the clsEVM and clsMonths classes, I use the following to set the
underlying classes:
'Set the entire WBSID collection
Property Set WBSIDs(S As Collection)
Set pWBSID = S
End Property
'Get the entire WBSID collection
Property Get WBSIDs() As Collection
Set WBSIDs = pWBSID
End Property
'Get a specific WBSID entry
Public Function WBSID(index As Variant) As clsWBSID
'If numeric, decalre based off index
If IsNumeric(index) Then
If index > pWBSID.Count Or index < 1 Then
Err.Raise 9
Else
Set WBSID = pWBSID(index)
End If
Else
Dim WP As clsWBSID
'If string, find appropriate value in collection
For Each WP In pWBSID
If UCase(WP.ChargeCode) = UCase(index) Then
Set WBSID = WP
Exit For
End If
Next
End If
End Function
My problem is that when I use the line:
Me.Month(iMonth).WBSID(sWBSID).ACWP = 5
in the clsEVM module, no matter what imonth is, all instances of sWBSID
found in any particular iMonth are made equal to 5, instead of just the 1
instance in iMonth. So if I have 3 months, and iMonth is = 1, sWBSID for
iMonth = 1, iMonth = 2, and iMonth = 3 will become 5 and I just want iMonth =
1 to equal 5. I can set an object to represent the individual Month in the
class to avoid the confusion, but I thought that was a bit redundant. Thanks
for any help on this. (I searched the MSDN and Chip's site to no avail)
clsEVM contains a collection of clsMonths which contains a collection of
clsWBSIDs
In the clsEVM and clsMonths classes, I use the following to set the
underlying classes:
'Set the entire WBSID collection
Property Set WBSIDs(S As Collection)
Set pWBSID = S
End Property
'Get the entire WBSID collection
Property Get WBSIDs() As Collection
Set WBSIDs = pWBSID
End Property
'Get a specific WBSID entry
Public Function WBSID(index As Variant) As clsWBSID
'If numeric, decalre based off index
If IsNumeric(index) Then
If index > pWBSID.Count Or index < 1 Then
Err.Raise 9
Else
Set WBSID = pWBSID(index)
End If
Else
Dim WP As clsWBSID
'If string, find appropriate value in collection
For Each WP In pWBSID
If UCase(WP.ChargeCode) = UCase(index) Then
Set WBSID = WP
Exit For
End If
Next
End If
End Function
My problem is that when I use the line:
Me.Month(iMonth).WBSID(sWBSID).ACWP = 5
in the clsEVM module, no matter what imonth is, all instances of sWBSID
found in any particular iMonth are made equal to 5, instead of just the 1
instance in iMonth. So if I have 3 months, and iMonth is = 1, sWBSID for
iMonth = 1, iMonth = 2, and iMonth = 3 will become 5 and I just want iMonth =
1 to equal 5. I can set an object to represent the individual Month in the
class to avoid the confusion, but I thought that was a bit redundant. Thanks
for any help on this. (I searched the MSDN and Chip's site to no avail)