a database can't be compacted while open... you would need code to run a external program, and close the database, then to exit the external program, and reload the database... it's not that easy...
--James
JHauge@jmjpc.net
Life is change. To deny change is to deny life.
I don't care about reloading the database; I'm trying to set this up to be automatically run when nobody is using the database. Is there some sort of command I can use in an external program to compact a database?
You can create a batch file with the following command: [tt]
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" \\MyServer\MainShare\db1.mdb /compact [/tt]
hth,
GGleason
batch files don't seem to like it any time i've done that, but that is the correct way to do it if it's timed
(i seem to alwas have to make a link, then call the link from a batch file, but i've gotten used to that)
i had a problem once with an automated compact once or twice... it hung the pc.. most of the time it worked ok...
one thing to remember, if any one is in the database at the time, it'll cancel it automaticly, and wont try to repeat it... so it'll go one time without... just a couple of things to remember...
--James
JHauge@jmjpc.net
Life is change. To deny change is to deny life.
call the following code from the on close event procedure of your main form (or an invisible form what loads when the client starts). I use it on NT and 2000.
'**********************************************************************************
Sub sbCompactCurrentDatabase()
Dim FS, a
Dim strWrite As String, strVBFilePath As String
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.