Issue SetField GetField

A

alex

Hi

This post is link to an old one I opened.
http://www.microsoft.com/communitie...b444&mid=4267f6a3-8eaf-46a6-bb4f-d80ca05d7e65

To summarize, I search several examples on Internet to initialize value.
I find several but each time it's not working.
I obtain the error 1101 during the execution.

So I try to do this thing below but it's the same.
I should miss something but I don't see what.
I appreciate your help.

Dim vLastWeekWork As String
vLastWeekWork =
T.GetField(FieldID:=Application.FieldNameToFieldConstant("Travail", pjTask))
T.SetField FieldID:=Application.FieldNameToFieldConstant("Travail",
pjTask), Value:=vLastWeekWork

Thank you.

Best regards,
Alexandre BARAULT
 
A

alex

Hi,

I continu to search,
I put Travail because it's the french version of "Work"

Dim vLastWeekWork As Variant
vLastWeekWork = T.GetField(FieldID:=FieldNameToFieldConstant("Travail",
pjTask))
Call T.SetField(FieldNameToFieldConstant("Travail"), vLastWeekWork)

But error is still here.

Best regards,
Alexandre BARAULT
 
J

Jack Dahlgren

If you are using work, why not refer to it directly?

t.travail =

-Jack Dahlgren
 
A

alex

When I take the spy I can see "44 hr" n T.Work.

The next line I try the 3 expressions.

T.Work = "44 hr" >> error 1101
T.Work = vLastWeekWork >> error 1101
T.Travail = vLastWeekWork >> error 438 error or method don't manage by this
object.

I really don't understand why I obtain this point.
I can post the entire code if necessary.

Best regards,
Alexandre BARAULT
 
J

Jack Dahlgren

Alex

Work is stored in minutes in numerical form.
Try using:

t.work = 480

that should set 8 hours of work.

-Jack Dahlgren
 
A

alex

Hi Jack,

I test as you propose but I obtain the error 1101

I update with two more pictures the document
http://docs.google.com/View?docid=dgq4sw2r_2059df5nwxdb

I see when I get it the spy indicates 466.52 hr.
So I follow your proposition and put 640 I obtain the error.
But if I put my pointer mouse on T.Work I can see 27991.
I try to put 27991 but error still here.

So I'm lost. is it a bug?
The property is read only?

I try T.Resources(0).Work = 640 it's the same error.

Best regards,
Alexandre BARAULT
 
A

alex

Hi Jack,

I continu to investigate.
If I try to do:

T.ActualWork = vLastWeekWork // avec vLastWeekWork = 694.45 hr and
ActualWork = 1260 //it's working
T.ActualWork = 480 //it's working
T.Work = T.ActualWork //T.work = 41667 // ERROR 1101

Best regards,
Alexandre BARAULT
 
A

alex

Hi Jack,

I'm very bad :)
I find it. It's because I try on a summary task.
I think I use the condition with task2 but I focus on the error.
So I continu.

Thank you.
Best regards,
Alexandre BARAULT
 
A

alex

Hi,

Finally,
I go back to my initiale issue with the resource work
I'm working on the resources from task2.
And I obtain the same error.
Normally everything is correct (not a summary task :))

i = 1
If (T.Name = "Tache2") Then
For i = 1 To T.Resources.Count
vLastWeekWork = T.Resources.Item(i).Work
T.Resources.Item(i).Work = vLastWeekWork //error 424
require object
T.Resources.Item(i).Work = MyResourcesTab(i, 0)
T.Resources.Item(i).ActualWork = MyResourcesTab(i, 1)
i = i + 1
Next i
End If

Do you have any idea?
Best regards,
Alexandre BARAULT
 
A

alex

Hi,

Finally I should use the assignments.
I thought the T.resources are the resource from the task.
But not.

Best regards,
Alexandre BARAULT
 
J

jack dahlgren

Alex,

Yes, you should loop through the Assignments on the task. Assignment is the
intersection of task and resource.
If you look at resource work it is all work for that resource. If you look
for task work it is all work for that task.
Assignment is for one resource on one task.

Good to see you are making progress! Next time it will be easier.

-Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top