Automate compacting Access 97 mdb

S

Steven

I am trying:

Dim DBName, NewDBName as String
DBName = "C:\Files\ExampleFile.mdb"
NewDBName = "C:\Files\NewFile.mdb"

DBEngine.CompactDatabase DBName, NewDBName

but the DBName file has a password and therefore I keep getting an error
message, "Not a valid password". The password is "accessgranted"

How do I code this so it will proceed with the compact.

Thank you for you help.

Steven
 
G

Granny Spitz via AccessMonster.com

Steven said:
Dim DBName, NewDBName as String

If you *don't* explicitly assign a data type to DBName (as it hasn't been in
this line of code), DBName will be a variant.
How do I code this so it will proceed with the compact

DBEngine.CompactDatabase DBName, NewDBName, dbLangGeneral &
";pwd=accessgranted", , ";pwd=accessgranted"
 

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