Compacting remote password-protected db

G

Guest

I am trying to compact a remote password protected db (MS Access97 or 2000).
My code is:
DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL & ";pwd = password"
I also have tried:
DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL,,";pwd = password"
I am getting an Error 3031 "not a valid password"

When I am compacting a not password-protected db it works fine.

What it is wrong in my code?
Please help!
 
A

Andi Mayer..

I am trying to compact a remote password protected db (MS Access97 or 2000).
My code is:
DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL & ";pwd = password"
I also have tried:
DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL,,";pwd = password"
I am getting an Error 3031 "not a valid password"

When I am compacting a not password-protected db it works fine.

What it is wrong in my code?
Please help!

the first should be right
is your password "password"
 
G

Guest

Thanks a for looking at it, I actually found the way it works:

DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL & ";pwd =" & strPassword, , ";pwd =" &
strPassword

So I guess, it didn't like the way I was passing a password and also the
last part that includes password is not as optional as it says in Help...

Thanks,
Olena
 
A

Andi Mayer..

Thanks a for looking at it, I actually found the way it works:

DBEngine.CompactDatabase strBackEndPath & strBackEndName, strBackEndPath &
"CompTemp.mdb", DB_LANG_GENERAL & ";pwd =" & strPassword, , ";pwd =" &
strPassword

So I guess, it didn't like the way I was passing a password and also the
last part that includes password is not as optional as it says in Help...
This I found also, but the advandage is: you can change the password

but if there is no password (strpassword="") you are in troubles again
 
G

Guest

No, not really. Here is what I did:

If strPassword = "" Then
DBEngine.CompactDatabase strBackEndPath & strBackEndName,
strBackEndPath & "CompTemp.mdb"
Else
DBEngine.CompactDatabase strBackEndPath & strBackEndName,
strBackEndPath & "CompTemp.mdb", DB_LANG_GENERAL & ";pwd =" & strPassword, ,
";pwd =" & strPassword
End If

It works fine :)
Thanks Andy.
Olena
 

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