actual start data

T

theintern

i'm trying to get it to start a task as soon as the resource finishes it's
current task. levelling would do this for me, except that half the time that
wipes out the actual start data. below is the code, which may make things
more clear. but something's not working. not really sure what, but it's
wiping out all actual start data to NA. any ideas would be much appreciated.

thanks
scott

Dim t1 As Task
Dim t2 As Task
Dim ts As Tasks
Dim n As Integer

Set ts = ActiveProject.Tasks
n = 0
For Each t1 In ActiveProject.Tasks
Set t2 = ts(n + 1)
If t1.ResourceInitials = t2.ResourceInitials Then t2.ActualStart =
t1.ActualFinish
n = n + 1
Next t1
 
J

Jan De Messemaeker

Hi,

First, it's definitely not leveling that wipes out actual data - it
definitely does not.
It must be something on your code.
I'll try to find it.

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
theintern said:
i'm trying to get it to start a task as soon as the resource finishes it's
current task. levelling would do this for me, except that half the time
that
wipes out the actual start data. b
elow is the code, which may make things
 
J

Jan De Messemaeker

Hi,

Please review the definitions of Actual Start and Actual Finish.
These are the values when a task HAS HAPPENED.
So you will only have an Actual Finish when the task is 100% complete if not
it is indeed NA.
Maybe this misunderstanding is also the origin of your "leveling" problem -
which isn't a leveling problem at all?

Hope this helps,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
J

Jack Dahlgren

Your code is all over the place. You are doing something strange with n for
some reason.

All you need is one task that is not complete to screw up all the rest of
the tasks.
Add a check to ensure that T1 has an actual finish.

I was going to suggest something like what I have below, but it occurs to me
that you are making some big assumptions. First that only one resource works
on each assignment - if not your matching by resource initials will fail.
Second that the tasks have only one successor and it is always the next task
- this is probably not always true. There are some others.

Think a bit harder about your algorithm to work out the corner cases. I'd
suggest an outer loop which goes through all tasks and when it hits one which
is complete it goes to the inner loop which goes through all tasks which do
not have an actual start and checks to see if they use the same resource. If
they do meet those conditions it finds the earliest of those tasks and sets
it to have an actual start same as the actual finish (note that the finish is
usually at the end of the day and start is usually interpreted as start of
day so you need to do some math to make it start the next day.

Anyway, I'm not convinced that the assumptions you are making are going to
be valid most of the time, so your code to handle those exceptions is going
to be correspondingly complex. I suggest designing the code before you start
writing it.

Dim t1 As Task
Dim t2 As Task
Dim ts As Tasks

Set ts = ActiveProject.Tasks

For Each t1 In ts
if t1.actualfinish <> "NA" then
Set t2 = ts(t1.ID + 1)
If t1.ResourceInitials = t2.ResourceInitials Then
t2.ActualStart = t1.ActualFinish
end if
end if
Next t1
 
T

theintern

Thanks so much to both of you for the replies. I too agree that this is not
the strategy i want. if i can level the resources i think that best. there
are, in fact, some large assumptions, some of which are valid for my special
situation, but others of which are not. i was mostly trying to get around my
code deleting Actual Start data (which is a different post) so i decided to
try this method, but i figured a way to solve the original problem so i think
i'll stick with that and ditch this janky solution. if you're curious about
the "n" thing, well, all i really know is C, which usess lots of counters and
i'm pretty much just doing this by the seat of my pants. yeah, we'll see how
that works out for me ;)

thanks again!
scott
 

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