Open and close an external Access file

gblack

Registered User.
Local time
Today, 23:45
Joined
Sep 18, 2002
Messages
632
What I want to do is set a backend database to compact on close...

Then close it from a seperate front end database... and then reopen it... all programmatically.

Is this possible? If so... how?
 
Have you checked the Help files under CompactDatabase??

Copies and compacts a closed database, and gives you the option of changing its version, collating order, and encryption.

Syntax
expression.CompactDatabase(SrcName, DstName, DstLocale, Options, password)

expression An expression that returns a DBEngine object.

JR
 
Yes, this does not allow you to compact an open database (like you can do manually whilst you have a database file open)...

The kicker is programmatically closing the database, just prior to compacting... I need to be able to close an open database from my code. The rest is a sinch.

Currently I can compact a closed database... I can also compact a closed database and then open the database, but once opened I cannot close it...

Thusly, you can never run a second compact without human intervention...
 
Have you looked into GetObject() ?

Code:
Function xTestIt()
Dim obj As Object
    Set obj = GetObject("d:\rtf.accdb")
        obj.Quit
    Set obj = Nothing
End Function

This code hooks onto a db called rtf and quits it IF it is open

Just a thought.

JR
 

Users who are viewing this thread

Back
Top Bottom