cdrivanova
Technical User
Hi all,
How can I concantenate X number of text fields into one Enterprise text field?
I know the code to just concatenate 2 fields and populate a third field:
Sub addFields()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then _
t.Text3 = t.Text1 + t.Text2
Next
End Sub
My problem is that I have X number of text fields, i.e., I don't know how many tasks will have this field populated.
Ex: in Project 1, 5 tasks have text1 populated. I want to populate Enterprise Text1 with: Task1.text1 + Task2.text1 + Task3.text1 + Task4.text1 + Task5.text1.
Ex: in Project 2, 2 tasks have text1 populated. For this, I want Enterprise Text1 to be populated with: Task1.text1 + Task2.text1.
So, I need to be able to count how many tasks have Text1 populated, concatenate all those texts fields and put that value into my Enterprise Text field.
Lastly, I want to overwrite Enterprise Text field every time the project is saved, so that the Enterprise Text field only contains current information.
Phew! Not too much to ask, I hope!
Thanks for any help you can provide,
Phyl
How can I concantenate X number of text fields into one Enterprise text field?
I know the code to just concatenate 2 fields and populate a third field:
Sub addFields()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then _
t.Text3 = t.Text1 + t.Text2
Next
End Sub
My problem is that I have X number of text fields, i.e., I don't know how many tasks will have this field populated.
Ex: in Project 1, 5 tasks have text1 populated. I want to populate Enterprise Text1 with: Task1.text1 + Task2.text1 + Task3.text1 + Task4.text1 + Task5.text1.
Ex: in Project 2, 2 tasks have text1 populated. For this, I want Enterprise Text1 to be populated with: Task1.text1 + Task2.text1.
So, I need to be able to count how many tasks have Text1 populated, concatenate all those texts fields and put that value into my Enterprise Text field.
Lastly, I want to overwrite Enterprise Text field every time the project is saved, so that the Enterprise Text field only contains current information.
Phew! Not too much to ask, I hope!
Thanks for any help you can provide,
Phyl