0

I am getting a 3001: Invalid argument error when trying:

DbEngine.CompactDatabase "db1.accdb", "db2.accdb", , dbEncrypt

I believe the function is using ACEDAO.DLL version 14.0.6016.1000

What could be the cause of the error? It only seems to happen with dbEncrypt.

CJ7
  • 22,579
  • 65
  • 193
  • 321

2 Answers2

1

As indicated in the article referred to in Remou's answer, dbEncrypt requires a password:

CompactDatabase firstdb, seconddb, ";pwd=secret", dbEncrypt

It also seems that an upgrade can't be done in the same call, thus I needed two lines to upgrade an older MDB to an encrypted ACCDB. Note the placement of the password in each line:

CompactDatabase oldMDB, encryptedDb, ";pwd=secret", dbEncrypt
CompactDatabase encryptedDb, upgradedDb, , dbVersion120, ";pwd=secret"

The following did not work and gave the Invalid argument error:

CompactDatabase oldMDB, encryptedAccdb, ";pwd=secret", dbEncrypt + dbVersion120

CJ7
  • 22,579
  • 65
  • 193
  • 321
0

It seems likely to be the password: http://social.msdn.microsoft.com/Forums/et-EE/accessdev/thread/317b025c-07ff-4c84-883f-5f602e88af9d

DbEngine.CompactDatabase "db1.accdb", "db2.accdb", ";pwd=apass"

When db2.accdb is opened, Decrypt database is an option.

Fionnuala
  • 90,370
  • 7
  • 114
  • 152