Passing password from Access

P

Phred Bear

I'm extracting some data from a P/W protected Access 2000 db, coding within
Access, to populate a map in MSP98. I can't get the syntax right to open the
project file without opening the "Password" messagebox in MS Project.

Since I need to ask the user earlier on for the password to gain access to
the db, I want to eliminate this additional request for the password. I
think I am not configuring the FileOpen arguments correctly because under
certain circumstances DatabasePassWord is ignored.

here is the code:

..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

.MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Name",
ExternalFieldName:="Ref No"

Several lines of MapEdit, then:

.FileOpen Name:=dbName, ReadOnly:=False, Merge:=0,
DatabasePassWord:="ThePassword", map:="Map 6"

dbName is a variable containing the path and name of the db, such as
"C:\Fred.mdb".

Any hints?
 
E

Earl Lewis

Phred,

You might want to specify the FormatID in the FileOpen method call. Here's what the help file says on the database password possibly being ignored.


DatabasePassWord Optional String. A password to use when accessing a database. If Name or FormatID isn't a database, DatabasePassWord is ignored.

Here's the FormatID help and allowed arguments:
FormatID Optional String for the file or database format. If Project recognizes the format of the file specified with Name, FormatID is ignored. FormatID can be one of the following format strings.

Format String Description
"MSProject.mpp.9" Project file
"MSProject.mpt.9" Project template
"MSProject.mpd" Project database
"MSProject.mpw" Project workspace
"MSProject.mpx" Project 4.0 MPX file
"MSProject.odbc" ODBC database
"MSProject.mdb.9" Microsoft Access database
"MSProject.xls5.9" Microsoft Excel workbook
"MSProject.csv.9" CSV (Comma delimited) file
"MSProject.txt.9" TXT (Tab delimited) file
"MSProject.XMLDOM" XML file

Good luck.

Earl
I'm extracting some data from a P/W protected Access 2000 db, coding within
Access, to populate a map in MSP98. I can't get the syntax right to open the
project file without opening the "Password" messagebox in MS Project.

Since I need to ask the user earlier on for the password to gain access to
the db, I want to eliminate this additional request for the password. I
think I am not configuring the FileOpen arguments correctly because under
certain circumstances DatabasePassWord is ignored.

here is the code:

..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

.MapEdit Name:="Map 6", DataCategory:=0, FieldName:="Name",
ExternalFieldName:="Ref No"

Several lines of MapEdit, then:

.FileOpen Name:=dbName, ReadOnly:=False, Merge:=0,
DatabasePassWord:="ThePassword", map:="Map 6"

dbName is a variable containing the path and name of the db, such as
"C:\Fred.mdb".

Any hints?
 
P

Phred Bear

"Earl Lewis" <Earldotlewisatutahdotedu> wrote in message

<< You might want to specify the FormatID in the FileOpen method call.
Here's what the help file says on the database password possibly being
ignored.>>

Earl,

I had already tried that amonst many other permutations.

I think I have just had the definitive answer from someone over on the
microsoft.public.project.vba forum saying it won't work like that. FileOpen
refers to a password which might have been set on the project not the
database. I'll find another workaround in Access using DAO.

Thanks anyway for your response.
 

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