Re: Compact/Repair



SheldonMopes@xxxxxxxxxx wrote:
> Here is my situation:I have several Access database projects that all
> keep their back-end data in a directory on a server. I would like to
> have a small Access application that could open each .mdb file, then
> compact and repair it, with no user intervention other than launching
> the application. Thank you for any help.

When compacting in code you can't compact a file onto itself so you also have to
include some renaming statements.

dbEngine.CompactDatabase "PathToFirstDatabaseSource"
"PathToFirstDatabaseDestination"

If Dir("PathToFirstDatabaseDestination") <> "" Then
Kill "PathToFirstDatabaseSource"
Name "PathToFirstDatabaseDestination" As "PathToFirstDatabaseSource"
End If

(repeat for as many files as you need)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.



Relevant Pages

  • Re: Compact/Repair
    ... > keep their back-end data in a directory on a server. ... There is the Jet Compact Utility, ... This can be run from .bat, vbScript, and Windows Shell Script files. ...
    (comp.databases.ms-access)
  • Compact/Repair
    ... Here is my situation:I have several Access database projects that all ... keep their back-end data in a directory on a server. ... Prev by Date: ...
    (comp.databases.ms-access)