Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Add data to the Task Usage sheet from my MS ACCESS Database

$
0
0

Hello

I have created 4 tables in MS ACCESS where

The first table contains a list of projets and the project id

The second table has resources and rates

The third table has assignment of resources to each of these projects.

I have loaded each of the projects as a task in MS Project and loaded the resources with the rates in resource sheet and used the assignment table and assigned all the projects to the resources.

The fourth table is the timephase table which has every resource linked with each of the task and their time by weeks in the table.

Project IDProject NameGL YearGL MonthResource NameStart_DateFinish_DateTotal Hours
KT00410Project Digital20141SPENCER L05-Jan-1411-Jan-141
KT00410Project Digital20141SPENCER L12-Jan-1418-Jan-143
KT00410Project Digital20142SPENCER L19-Jan-1425-Jan-141

How do i enter this data in the Task Usage sheet. 

Thanks

Ram

This is the code i have so far

'Create Connection to the .mdb file

With Files

.DialogTitle = "Please Find .mdb file"

.Filter = "Access Files|*.accdb"

Files.ShowOpen

Conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" _

& Files.FileName & ";Persist Security Info=False"

Conn.Open

End With

'Setup up new Project file

Application.FileNew

'Import all Tasks

' If a Task has a Predecessor ignore its dates

Set rs = New ADODB.Recordset

rs.Open "SELECT * FROM Task_Table", Conn

'ActiveProject.ProjectStart = rs![Start Date]

FirstTask = True

Do Until rs.EOF

Set Tsk = ActiveProject.Tasks.Add(CStr(rs![ABC Name]))

Tsk.Text1 = rs.Fields(0).Value

If FirstTask Then 'If first Task, do nothing

FirstTask = False

Else

End If

rs.MoveNext

Loop

rs.Close

'Import all Resources

rs.Open "SELECT * FROM Resource_Table ORDER BY [Resource_Name]", Conn

Do Until rs.EOF

Set Res = ActiveProject.Resources.Add(CStr(rs![Resource_Name]))

Res.StandardRate = rs.Fields(1).Value

rs.MoveNext

Loop

rs.Close

'Make Assignments of Resources on Tasks

rs.Open "SELECT * FROM Assignment_Tbl ORDER BY [ABC Name]", Conn

Do Until rs.EOF

Set Tsk = ActiveProject.Tasks(CStr(rs![ABC Name]))

Set Res = ActiveProject.Resources(CStr(rs![Res_Name]))

'Units = rs!Units

Set Ass = Tsk.Assignments.Add(ResourceID:=Res.ID)

rs.MoveNext

Loop

rs.Close

MsgBox "Yay I am done", vbOKOnly

'Tidy up

Set rs = Nothing

Conn.Close

Set Conn = Nothing

End Sub


R


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>