Opening msproject files from Access.mdb format

H

Henrik Hansen

Hi,

I'm not sure if this is the right spot?

Having problem with opening project files in .mdb format through
Access. I have made a template in MS Project 2002, which is sharing a
resourcepool. The template allows the user to connect to the
resourcepool and then save the project in database format .mdb.

In the database I have made some queries that extract the information
required from the various project saved. In the queries I have made a
full path column by cancatenating the fields in the following format
Link: "<" & [PROJ_DATA_SOURCE] & ">\" & [PROJ_NAME], this is then
updated in a new table where the link is hyperling format. However
this didn't work.

Then I tried to make the opening through VBA by creating the same link
string and open it through the following code in an Access form

Private Sub PROJ_DATA_SOURCE_Click()
Dim objPrj As Object
Dim strFile As String
strFile = Me.PROJ_NAME
On Error Resume Next

Set objPrj = GetObject("msproject.Application") 'Get the application
if it is running
If Error Then 'Ups it was not running

Set objPrj = CreateObject("msproject.application") 'Create an
instance
End If

FileOpen Name:="<C:\Dokumenter\testProject.mdb>\" & strFile,
ReadOnly:=False, FormatID:="MSProject.MDB8"
Set objPrj = Nothing
End Sub

Nothing happens. If I go to Project and open the files throgh the
normal way it works.

So, it might be a locking issue? I'm using recordlevel locking in the
Access database.

I have tried to use the common dialog code from mvps.org/api but that
didn't help either.

Could anybody give me a hint please?

regards
Henrik
 
R

Rod Gill

Hi,

Try:

objPrj.FileOpen Name:="<C:\Dokumenter\testProject.mdb>\" & strFile,
ReadOnly:=False, FormatID:="MSProject.MDB8"

I'm not sure the rest of the FileOpen format is correct, so in Project
record a macro of you opening a project from a database manually and copy
then edit the code it records.
--
Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.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