Compact and Repair elsewhere

S

Stapes

Hi

I have a button for Compact and Repair database. This is the code
behind it:

CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction

Unfortunately, this only operates on the front end, but where it
really needs it is on the backend. Can I use this code to make it
compact and repair another database file?

Stapes
 
S

Stapes

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "CompactBackEndDB.mdb" which illustrates how to do this.

--
--Roger Carlson
MS Access MVP
Access Database Samples:www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L










- Show quoted text -

Hi

I have borrowed code from your database. However, whenever I try to
run the Compact, I get an error:

3356 You attempted to open a database that is already opened
exclusively by user 'Admin' on machine 'CIOS05'. Try again when the
database is available.

It works OK in your database. What am I doing wrong?

Stapes
 
S

Stapes

You will get the same error in my sample if you open the linked table and
leave it open while you compact it. You can't have any of the tables open
or any forms or queries open that are based on any tables in the back end
database.

--
--Roger Carlson
MS Access MVP
Access Database Samples:www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L









- Show quoted text -

Is there any way I can query which forms are open and then close them?
I think this is my problem. And will the code still execute even if
the form which has called it been closed?
Ideally, I would want it to re-open again and report that the Compact
and Repair was successful.

Stapes
 

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