TimeScaleValues out of Range

D

Dustin Ventin

I am writing an Access program that exports data into Microsoft Project,
including the TimeScaleValues of various tasks. This code loops through the
tasks required, and exports the TimeScaled Values that apply to that task:

Do Until rsAssignmentsNeeded.EOF
Set objAssignment = Nothing
Set objAssignment =
ProjApp.Application.ActiveProject.Tasks(rsAssignmentsNeeded(0)).Assignments.Add(ResourceID:=rsResourceNumber(0).Value)

rsExportData.MoveFirst
Do Until rsExportData.EOF 'Loop through and insert TimeScaledData
If rsExportData(1) = rsAssignmentsNeeded(0) Then
Set TSV =
objAssignment.TimeScaleData(CDate(rsExportData(2)), CDate(rsExportData(2)),
pjAssignmentTimescaledActualWork, pjTimescaleDays)
TSV.Add CDec(rsExportData(3)), 1
End If
rsExportData.MoveNext
Loop

rsAssignmentsNeeded.MoveNext
Loop

The trouble is, if the date is out of range, an error is thrown. Is there
any way to have Project automatically extend the duration of the task to
include the out-of-range date? At the very least, is there any way to have
it so that, if an error is thrown, the loop continues without throwing an
error and stopping the function?

(If this were all Access VBA, it wouldn't be difficult, but I believe the
error is being thrown by Project, so doesn't Project have to deal with it?
Is there any way for me to have Access handle the Project error?)

Thanks!

Dustin
 
R

Rod Gill

Hi,

You need to test the date range. If the proposed date is a time period after
the end of your timephasedate collection, you need to do more TSV.Add
statements to extend the date range covered.
 

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