Provider Syntax

S

Shane Garlick

I'm trying to access the data found in a MS Project database using an MS Access database (there seems to be a lot of interest for this). This can be done using ADO OLE DB. To use this, you need a provider for the data source. I believe the provider for Project is Microsoft.Project.OLEDB.10.0. However, I'm not familiar with the syntax used. What I have is

Dim cnDB As ADODB.Connectio

Function OpenProject(
Set cnDB = CreateObject("ADODB.Connection"
cnDB.ConnectionString = "Provider = Microsoft.Project.OLEDB.10.0;"
& "Data Source = C:\ProjectFile.mpp
cnDB.Ope
End Functio

The problem: when I run this script, the error says it can't find the file, even though the file is there. I know that the provider is available because; 1) it gets loaded when Project is loaded and 2) it's in the list
Am I writing the script correctly? Is there a source to help someone with ADO scripting

Thx
 
J

Jack D.

Shane said:
I'm trying to access the data found in a MS Project database using an MS
Access database (there seems to be a lot of interest for this). This can
be done using ADO OLE DB. To use this, you need a provider for the data
source. I believe the provider for Project is
Microsoft.Project.OLEDB.10.0. However, I'm not familiar with the syntax
used. What I have is:

Dim cnDB As ADODB.Connection

Function OpenProject()
Set cnDB = CreateObject("ADODB.Connection")
cnDB.ConnectionString = "Provider = Microsoft.Project.OLEDB.10.0;" _
& "Data Source = C:\ProjectFile.mpp"
cnDB.Open
End Function

The problem: when I run this script, the error says it can't find the
file, even though the file is there. I know that the provider is
available because; 1) it gets loaded when Project is loaded and 2) it's
in the list.
Am I writing the script correctly? Is there a source to help someone with
ADO scripting?

Thx


There are some examples in the documentation. Check your project disk or
your hard drive for a file named prjoledb.htm.
Here is a snipet which seems to indicate that you have to use "PROJECT
NAME=" instead of "Data Source ="

Sub Connect()
Dim conData As New ADODB.Connection
Dim rstAssigns As New ADODB.Recordset
Dim intCount As Integer
Dim strSelect As String
Dim strResults As String

conData.ConnectionString =
"Provider=Microsoft.Project.OLEDB.10.0;PROJECT NAME=" & FILE_NAME
' To connect to a Microsoft SQL Server file, you must also supply User ID
and Password arguments
' conData.ConnectionString = "Provider=Microsoft.Project.OLEDB.10.0;User
ID=jsmith;Password=MyPass5;PROJECT NAME=" & FILE_NAME

conData.ConnectionTimeout = 30
conData.Open

--
Please try to keep replies in this group. I do check e-mail, but only
infrequently.
For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 

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