Concatenate custom text fields into one Enterprise text field

Concatenate custom text fields into one Enterprise text field

Post by pblan » Fri, 13 Feb 2004 10:51:57

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

Sub addFields()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then _
t.Text3 = t.Text1 + t.Text2
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 populates 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,