M
Mona-ABE
I have a form with 12 text boxes each named "txtCapacity" & Jan - Dec (in
other words "txtCapacityJan", "txtCapacityFeb", "txtCapacityMar", etc.)
I'm using the code between the dashed lines to try to loop through the
textboxes and set the available work days for each month. I'm getting the
error "object needed" and I know I need to set my object variables (see ???
below), but I'm having no success. I need to include all 12 text boxes
starting with "txtCapacity" in their name.
-------------------
Dim intNumOfWorkDays As Integer
Dim MyObject As Control, MyCollection As Controls
??? set myCollection =
??? set myObject =
For Each MyObject In MyCollection ' Iterate through each element.
If Left(MyObject.Name, 11) = "txtCapacity" Then ' If Name equals
"txtCapacity".
intNumOfWorkDays = dhCountWorkdaysA(Right(MyObject.Name, 3) & " 1,
2006", Right(MyObject.Name, 3) & " 31, 2006", Array(#1/1/2000#, #7/4/2000#))
MyObject.Value = intNumOfWorkDays
Exit For ' Exit loop.
End If
Next
-------------------
Also, I really need help with this part too:
dhCountWorkdaysA([startdate], [enddate], Array([holidays]))
[startdate] should be = Right(MyObject.Name, 3) & [lowestdayinthatmonth] &
[currentyear]
[enddate] should be = Right(MyObject.Name, 3) & [highestdayinthatmonth] &
[currentyear]
How do I calculate the lowest and highest day of the month that is
represented by the last three characters of the textbox's name? And how do I
get the current year?
Please let me know if I should have approached this differently.
other words "txtCapacityJan", "txtCapacityFeb", "txtCapacityMar", etc.)
I'm using the code between the dashed lines to try to loop through the
textboxes and set the available work days for each month. I'm getting the
error "object needed" and I know I need to set my object variables (see ???
below), but I'm having no success. I need to include all 12 text boxes
starting with "txtCapacity" in their name.
-------------------
Dim intNumOfWorkDays As Integer
Dim MyObject As Control, MyCollection As Controls
??? set myCollection =
??? set myObject =
For Each MyObject In MyCollection ' Iterate through each element.
If Left(MyObject.Name, 11) = "txtCapacity" Then ' If Name equals
"txtCapacity".
intNumOfWorkDays = dhCountWorkdaysA(Right(MyObject.Name, 3) & " 1,
2006", Right(MyObject.Name, 3) & " 31, 2006", Array(#1/1/2000#, #7/4/2000#))
MyObject.Value = intNumOfWorkDays
Exit For ' Exit loop.
End If
Next
-------------------
Also, I really need help with this part too:
dhCountWorkdaysA([startdate], [enddate], Array([holidays]))
[startdate] should be = Right(MyObject.Name, 3) & [lowestdayinthatmonth] &
[currentyear]
[enddate] should be = Right(MyObject.Name, 3) & [highestdayinthatmonth] &
[currentyear]
How do I calculate the lowest and highest day of the month that is
represented by the last three characters of the textbox's name? And how do I
get the current year?
Please let me know if I should have approached this differently.