SOLVED

Display Auto-Populated Resource Field on Task Sheet

%3CLINGO-SUB%20id%3D%22lingo-sub-2365620%22%20slang%3D%22en-US%22%3EDisplay%20Auto-Populated%20Resource%20Field%20on%20Task%20Sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2365620%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20list%20of%20resources%20and%20associated%20info%20(resource%20name%2C%20group%2C%20etc...).%20Two%20of%20these%20fields%20are%20customer%20resource%20fields%20(Text1%2C%20Text2).%20When%20I%20am%20on%20my%20Task%20Sheet%20I%20select%20a%20resource%20and%20the%20Resource%20Group%20field%20auto-populates.%20However%2C%20I%20need%20those%20other%20fields%20from%20the%20Resource%20list%20in%20my%20view%20as%20well%2C%20and%20when%20I%20try%20to%20add%20them%2C%20it%20only%20allows%20me%20to%20select%20Task%20fields%20(i.e.%20not%20all%20resource%20fields%20are%20in%20the%20list).%20Is%20there%20any%20way%20to%20do%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2365620%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EProject%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2368411%22%20slang%3D%22en-US%22%3ERe%3A%20Display%20Auto-Populated%20Resource%20Field%20on%20Task%20Sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2368411%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1057077%22%20target%3D%22_blank%22%3E%40AndrewButters%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%3F%20Yes%2C%20but%20it%20requires%20either%20manual%20entry%20or%20some%20VBA.%20Rather%20than%20explaining%20it%20all%20here%2C%20I%20suggest%20you%20take%20a%20look%20at%20the%20following%20Wiki%20article%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F32051.ms-project-extra-fields-in-views.aspx%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F32051.ms-project-extra-fields-in-views.aspx%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJohn%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2368419%22%20slang%3D%22en-US%22%3ERe%3A%20Display%20Auto-Populated%20Resource%20Field%20on%20Task%20Sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2368419%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F917748%22%20target%3D%22_blank%22%3E%40John-project%3C%2FA%3E%26nbsp%3BThank%20you%2C%20I%20will%20check%20out%20the%20article.%20I'm%20no%20stranger%20to%20VBA%20and%20really%20hoping%20to%20avoid%20manual%20entry%20since%20I%20have%20hundreds%20of%20these%20things%20to%20maintain.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2368579%22%20slang%3D%22en-US%22%3ERe%3A%20Display%20Auto-Populated%20Resource%20Field%20on%20Task%20Sheet%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2368579%22%20slang%3D%22en-US%22%3EI%20got%20the%20macro%20to%20work%20but%20only%20see%20the%20change%20on%20the%20Task%20Usage%20View%20but%20what%20I%20really%20need%20is%20for%20it%20to%20show%20up%20when%20I'm%20editing%20from%20the%20Task%20Sheet.%20I%20tried%20removing%20and%20re-adding%20the%20fields%20to%20the%20Task%20Sheet%20but%20the%20data%20only%20shows%20up%20when%20I%20am%20looking%20at%20the%20Task%20Usage%20View.%20Any%20thoughts%3F%3C%2FLINGO-BODY%3E
Occasional Contributor

I have a list of resources and associated info (resource name, group, etc...). Two of these fields are customer resource fields (Text1, Text2). When I am on my Task Sheet I select a resource and the Resource Group field auto-populates. However, I need those other fields from the Resource list in my view as well, and when I try to add them, it only allows me to select Task fields (i.e. not all resource fields are in the list). Is there any way to do this?

8 Replies

@AndrewButters 

Is there a way? Yes, but it requires either manual entry or some VBA. Rather than explaining it all here, I suggest you take a look at the following Wiki article:

https://social.technet.microsoft.com/wiki/contents/articles/32051.ms-project-extra-fields-in-views.a... 

 

John

@John-project Thank you, I will check out the article. I'm no stranger to VBA and really hoping to avoid manual entry since I have hundreds of these things to maintain. 

I got the macro to work but only see the change on the Task Usage View but what I really need is for it to show up when I'm editing from the Task Sheet. I tried removing and re-adding the fields to the Task Sheet but the data only shows up when I am looking at the Task Usage View. Any thoughts?
best response confirmed by AndrewButters (Occasional Contributor)
Solution

The macros in the Wiki article are structured to transfer assignment data to task data or vice versa. It sounds like like what you want to do is to transfer resource data to task data. That is easy enough as long as there is only one assigned resource per task but it presents a dilemma if more than one resource is assigned to a given task, as is often the case.

However, if you do have a single resource assigned to each task, then this code should give you what you want.
Sub ResToTsk()
Dim t As Task
For Each t In ActiveProject.Tasks
  If Not t Is Nothing Then
    If t.Assignments.Count > 0 Then
      t.Text1 = ActiveProject.Resources(t.Assignments(1).ResourceID).Text1
      t.Text2 = ActiveProject.Resources(t.Assignments(1).ResourceID).Text2
    End If
  End If
Next t
End Sub

If you have more than one resource assigned per task, then you need to determine which resource's custom field is transferred to the task custom field.
John

@John-project Alas, I am getting an error. 

 

Run-time error '1101': 

The argument value is not valid.

 

When debugging it highlights this line: 

 t.Text1 = ActiveProject.Resources(t.Assignments(1).ResourceID).Text1

Check my posted code again. I added a couple of lines to account for tasks that have no resources assigned.

John

@John-project It works! Thank you so much, this is going to save me a lot of time and hassle. 

AndrewButters,
You're welcome and thanks for the feedback.
John