OK, so what am I doing wrong

K

Kevin Newman

I need to populate several MSProject Server 2003 Enterprise Number fields for
each task in a project. I am trying to do this programatically in MSAccess. I
have tried two methods. one using SQL. Both methods create the appropriate
records in the MSP_NUM_FIELDS table (they are visible in the table), but the
results are not visible when I open the project.All I can figure is that I
need to update some references in another table or two in order for this to
work, but I am at a loss as to which one(s)

Here is the SQL statement for one field (sorry about the formatting):

INSERT INTO dbo_MSP_NUM_FIELDS ( PROJ_ID, NUM_CATEGORY, NUM_REF_UID,
NUM_FIELD_ID, NUM_VALUE )
SELECT dbo_MSP_PROJECTS.PROJ_ID, 0 AS Category, SourceTable.TaskNumber,
188744379 AS Fld_ID, SourceTable.WorkOrderNumber AS WorkOrder
FROM (SourceTable INNER JOIN dbo_MSP_PROJECTS ON SourceTable.ProjectName =
dbo_MSP_PROJECTS.PROJ_NAME) INNER JOIN dbo_MSP_TASKS ON
(SourceTable.TaskNumber = dbo_MSP_TASKS.TASK_UID) AND
(dbo_MSP_PROJECTS.PROJ_ID = dbo_MSP_TASKS.PROJ_ID);

I have also tried VBA/DAO as follows:

Sub Populate_Flds()

Dim dbs As Database
Dim rst4 As Recordset
Dim rst5 As Recordset

Set dbs as CurrentDb
Set rst4 = dbs.OpenRecordset("SourceTable")
Set rst5 = dbs.OpenRecordset("dbo_MSP_NUMBER_FIELDS")

'add values to custom fields
rst4.MoveFirst
cnt = 1
With rst5
.AddNew
!PROJ_ID = <variable containing ProjectID Number>
!NUM_CATEGORY = "0"
!NUM_REF_UID = rst4!TaskNumber
!NUM_FIELD_ID = "188744379"
!NUM_VALUE = rst4!WorkOrder
.Update
End With
Do Until cnt = rst4.RecordCount
rst4.MoveNext
With rst5
.AddNew
!PROJ_ID = <variable containing ProjectID Number>
!NUM_CATEGORY = "0"
!NUM_REF_UID = rst4!TaskNumber
!NUM_FIELD_ID = "188744379"
!NUM_VALUE = rst4!WorkOrder
.Update
End With
cnt = cnt + 1
Loop

End Sub

So what am I missing?
 
K

Kevin Newman

Nevermind. I found out that I needed to set the appropriate External Editing
Fields to true. Works now.
 

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