I have to compact and repair an Access 2007 .accdb database file. I understand that JRO.JetEngine can perform this with .mdb files, but I have to repair the more recent version 2007 format by code.

Any suggestions?

EDIT:

Here's the one thing: I discovered will be able to make use of the COM object library "Microsoft 'office' 12 Access Database Engine Object Library" and employ the DBEngine class and call its CompactDatabse method. But there does not appear to become a place that i can supply the database password Appears like Office 12 Database Engine does not have documentation anywhere. I discovered some documentation for older versions of CompactDatabase method but individuals don't assist me to whatsoever.

This really is driving me crazy.

Appears like Office 12 Database Engine does not have documentation anywhere.

Less than true. There's limited information available.

On MSDN, see:

Access 2007 Developer Reference

There's a branch for Microsoft Jet Replication Objects (JRO) Reference, so JRO (among the libraries comprising ADO classic) continues to be formally supported (and AFAIK does still work) for ACE e.g. the accdb format. The CompactDatabase method takes two parameters, each of which is definitely an OLE DB connection string. Therefore, delivering the database password should not be a not the same as a normal connection e.g. using Jet OLEDB:Database Password within the connection string. Remember, for accdb format you have to include Jet OLEDB:Engine Type=5 within the connection string e.g.

Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:\MyDB.accdb;
Jet OLEDB:Database Password=MYPASSWORD;
Jet OLEDB:Engine Type=5

For which it's worth (very little, because it works out), limited documentation for that ACE engine can be found in the Office Help for Access 2007.

Keep in mind, the majority of the Access Database Engine was created throughout the the nineteen nineties when proprietary formats were extremely popular I suspect documentation was covered up for commercial reasons and also the understanding is just lost. So you will find many holes within the presently-available documentation, and enormous ones at this. Frequently, the only method of discovering the way the engine works would be to uncover it through actual usage. The documentation that does exist consists of some appalling errors: already today I have published a few good examples on Where potentially use yet make believe functionality (LIMIT TO nn ROWS, CREATE TEMPORARY TABLE, etc) continues to be marketed within the Access Help. Caveat emptor.

You do not need JRO. JRO shouldn't even exist -- it is among the ugly stepchildren of ADODB that came into being due to Microsoft's misguided make an effort to replace Access/Jet/ACE's native DAO with ADO, a non-native abstraction layer. JRO can there be to supply support for Jet-specific functionality unavailable in ADODB.

Should you used DAO rather, you'd have the functionality immediately already, and delay pills work for those formats based on the version of Access you are using (because the DAO version is synchronized together with your Access version, that's, once the db engine is enhanced, there is a latest version of DAO to choose it).

So, in A2007, you'd simply employ the DAO compact techniques (there is no repair operation like a separate command since Access 2, along with a repair happens only when the database engine determines throughout the compact that the repair is essential). If you are working from outdoors Access, then you should utilize the ACE-compatible version of DAO. If you don't have A2007 installed and also have installed the ACE individually, you've that version of DAO installed together with it.

Just an FYI regarding JRO, it doesn't support Access version 2007 or greater database files. As the CompactDatabase method within this library seems to operate while using the ACE OLEDB Provider, it'll actually produce a 2002-2003 (Jet 4.) database file.

BTW, an electric train engine Type = 5 is Jet 4., to ensure that ought to be a defunct giveaway regarding version produced.