Sending the password in FileOpen

P

Phred Bear

I am creating an MSP Project from a P/W Protected Access 2000 db and
populating it in VBA.
I don't seem able to make the DatabasePassWord argument stick.
here is the code:

Header:
pj.MapEdit Name:="Map 6", Create:=True, OverwriteExisting:=True,
DataCategory:=0, CategoryEnabled:=True, TableName:="BarChart",
FieldName:="ID", ExternalFieldName:="ID", ExportFilter:="All Tasks",
ImportMethod:=pjImportAppend, HeaderRow:=True

Meat in the sandwich:
pj .MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Name",
ExternalFieldName:="Ref No"

Several lines of MapEdit, then:

Footer:
pj.FileOpen Name:="C:\Fred.mdb", ReadOnly:=False, Merge:=0,
DatabasePassWord:="ThePassword", map:="Map 6"

It works fine on a non protected db.


Any hints?
 
R

Rod Gill

Hi,

There are two passwords, one to open the database and one for permission to
open the project. I suspect you have the two mixed up. Try recording a
project of you opening the project manually and see what gets recorded.

You may need to use DAO to actually open the database .mdb file in Access
first providing the database password in the process and then open the
project providing the project password if set.
 
P

Phred Bear

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message

<< There are two passwords, one to open the database and one for permission
to
open the project. I suspect you have the two mixed up. Try recording a
project of you opening the project manually and see what gets recorded.

You may need to use DAO to actually open the database .mdb file in Access
first providing the database password in the process and then open the
project providing the project password if set.>>

Rod,

That doesn't work, sadly. This was an abbreviated version of a message I
posted in "Microsoft.public.project.developer" and got no replies but I
think I abbreviated the sense out of it.

The db is password protected but the project file is a new file and isn't
protected. I do what you suggest and open the db using DAO with a line like

"Set db = OpenDatabase("C:\MyDatabase.mdb", False, False, "MS Access;
pwd=ThePassword")" which works fine on the db for doing the selection query
and creating the table which I export from. So far so good.

The rest of the procedure creates a new MSP file and creates new views ready
for the mapping of data but then it won't connect to the db.

I get the MSP Login dialogbox to enter the db password.

When I record this bit, there is no mention of acquiring the password in
the resultant code although I have to enter the p/w in the Login Dialog Box.
Here is the relevant line :-

FileOpen Name:="<D:\MyDatabase.mdb>", ReadOnly:=False, Merge:=0,
FormatID:="MSProject.MDB8.8", map:="Map "

I have added the argument DatabasePassWord:= "MyPassword" but it still
ignores it. The "FileOpen" help file says under certain circumstances, the
DatabasePassWord argument is ignored but looking at my stuff, I thought it
met the requirements.

If I can't get this working I think I will have to export the data table
from my Data db, which is protected, into my Switchboard db, which isn't. I
will then be able to access it from MSP OK. It is just an untidy way of
doing it.

Most grateful if you can give me your views.




<<I am creating an MSP Project from a P/W Protected Access 2000 db and
populating it in VBA.
I don't seem able to make the DatabasePassWord argument stick.
here is the code:

Header:
pj.MapEdit Name:="Map 6", Create:=True, OverwriteExisting:=True,
DataCategory:=0, CategoryEnabled:=True, TableName:="BarChart",
FieldName:="ID", ExternalFieldName:="ID", ExportFilter:="All Tasks",
ImportMethod:=pjImportAppend, HeaderRow:=True

Meat in the sandwich:
pj .MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Name",
ExternalFieldName:="Ref No"

Several lines of MapEdit, then:

Footer:
pj.FileOpen Name:="C:\Fred.mdb", ReadOnly:=False, Merge:=0,
DatabasePassWord:="ThePassword", map:="Map 6"

It works fine on a non protected db.


Any hints?>>
 
R

Rod Gill

Basically the password in file open is for when you set a password in
Project for read only or full access. It has nothing to do with the database
password. I suggest removing the database password and putting the database
in a folder where you can set folder permissions to exclude everyone but the
people you want to have access.
 
P

Phred Bear

"Rod Gill" <rod AT project-systems DOT co DOT nz> wrote in message

<< Basically the password in file open is for when you set a password in
Project for read only or full access. It has nothing to do with the
database
password. >>

Ahaaaa!

I didn't realize that. I thought it did what it's name implied i.e. set the
password of the Database.

Now that I know that I can find another way of doing it.

Thanks for pointing it out.
 

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