Automate compacting Access 97 mdb

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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"
 
Back
Top