Hidden System Commands

T

Terry

Does anyone know if there is a hidden system command to
compact a database using vb in a module?
For example
Call SysCmd(504, 16483)
This calls a hidden system command to automatically
compile and save all modules.
 
D

Douglas J. Steele

Why bother with a hidden system command when there's a built-in one? (The
CompactDatabase method of the DBEngine object) Yes, it needs a reference to
DAO and you've posted in the ADO newsgroup, but so what: you can reference
both libraries. If you don't want the DAO reference, set one to JRO and
following the instructions in
http://support.microsoft.com/?id=230501
 
T

terry

Douglas,
Thank you for that. I wanted to compact the open database
but you cannot use either of these in the same db as the
one you wish to compact. Is there no code to compact the
open database?
 
T

terry

I have tried the TISCompacter as on Petes question, but it
doesnt seem to do anything. I have refrenced the dll ok.
But when I run the module it doesnt compact? What am I
missing?
 
D

Douglas J. Steele

Did you follow the instructions in the file TSISoon90.txt that was in the
download?
 
T

terry

Yes followed the instructions, installing the vb6 files
and adding the dll to th registry, but nothing.
 
D

Douglas J. Steele

And you put the following code in your existing MDB?

With COMAddIns("TsiSoon90.Connect").Object
.FileToOpen = CurrentProject.FullName
.Exclusive = False
.FileIsAdp = False
.CompactOld = True
.CloseAll
End With
 
D

david epsom dot com dot au

Compact always compacts to a new database: it
then may delete the old database and rename the
new database (and open the new database.)

The syscmd for compact is 602

You may also start a copy of MSACCESS.EXE and use
the command line switch to compact.

(david)
 
T

terry

david have tried this in a module in my db but doesnt seem
to do anything...im using Call SysCmd (602)...is this
right?
 
D

david epsom dot com dot au

Compact always compacts from a (closed) database to
a new database, so like this:

AccessObj.SysCmd 602, "db1.mdb", "db2.mdb"

It needs exclusive on "db1", so you can't do this
from inside "db1"

(david)
 

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