Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use MS Access to query MS Project files. 1

Status
Not open for further replies.

Klopper

MIS
Dec 7, 2000
84
US
Like one can with MS Excel (and MS FoxPro, dBase, ODBC etc.) files, can I use MS Access to directly query the data contained MS Project files?





 
I'm not familiar with Project 2000 but I've never been able to do that with Project 98. Now, there are work-arounds if you want. 1) You can save Project tables as tables in Access and then get the information. 2) You could open a recordset then open project and iterate through the tabledata while filling in the recordset. 3) You could open Project with automation and read through all the table data. Too bad you can't do it though, I would be able to use it a lot easier.

Microsoft used to send out a copy of their 'Microsoft Project 98 Visual Basic Environment' document upon request and they also had it on their web support site for a while. There is no index but there are quite a few examples of what you can do. I believe I have a electronic copy if you want.

Steve King Growth follows a healthy professional curiosity
 
Thanks Steve, you have confirmed my suspicions.

Option 2 looks best, but I am not sure how I would "get hold" of the data in the Project. Any sample code to point me int the righ direction?

Regards
Klopper
 
Unfortunately, all my code goes the other way. I build an MPX file which is then opened by Project and can be saved as a native MPP file.

Use this as a sample. It merely prints the task names, duration, and start date. Remember you will need to set Microsoft Project as a reference.

Public Sub Proj()

Dim oProj As Object
Dim oTsk As Task
Dim MyAppID As Long

Set oProj = GetObject("f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX", "MSProject.Project")
If Err <> 0 Then
MyAppID = Shell(&quot;C:\Program Files\Microsoft Office\Office\WINPROJ.EXE&quot;, 1) ' Run Microsoft Word.
'AppActivate MyAppID ' Activate Microsoft
Set oProj = GetObject(&quot;f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX&quot;, &quot;MSProject.Project&quot;)
End If
oProj.FileOpen Name:=&quot;f:\groups\sdv\dmats\scking\mpx\CPSG_MAFC_SCHEDULE_0199.MPX&quot;
For Each oTsk In oProj.Tasks
Debug.Print oTsk.Name, oTsk.Duration, oTsk.Start
Next oTsk

End Sub

Steve King Growth follows a healthy professional curiosity
 
Spot on Steve, many thanks for the help.

The &quot;Remember you will need to set Microsoft Project as a reference&quot; bit was the key - it is always the simplest things that causes the greatest loss of hair!

Klopper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top