By the sounds of it you do not have Scriptinf installed on your pc. It is usually installed with Internet Explorer 5 I think, but your system admin may have crippled itf.
To work round it, you will need to use another database file so:
Create a blank file and call it CompactDB.mdb
Copy this code into a module -
Function CompactExternalDB()
Dim jEngine As Object
Set jEngine = CreateObject("DAO.DBEngine.36"

'change this to DAO.DBEngine.35 if you are using Access 97
'Create a jet engine to work from
fn = Dir(Left(Command(), Len(Command()) - 3) & "ldb"

Do Until fn = ""
fn = Dir(Left(Command(), Len(Command()) - 3) & "ldb"

'check for an ldb file for the database we are compacting.
'can't sompact until everyone is out of it
Loop
jEngine.CompactDatabase Command(), Left(Command(), Len(Command()) - 3) & "cmp"
'compact the database to a file with a cmp extension
Kill Command
'delete the old file
Name Left(Command(), Len(Command()) - 3) & "cmp" As Command()
'rename the compacted file
Set jEngine = Nothing
Application.Quit acQuitSaveNone
'close this file
End Function
Save the module and create a new macro. The only thing you want in the macro is a RunCode command and type CompactExternalDB() in the option.
Save the macro with the name AutoExec and close the database file.
In the mdb you want to compact add the following subroutine:
Sub CompactThisDB()
Shell SysCmd(acSysCmdAccessDir) & "msaccess.exe " & "[PathToCompact.mdb]\compactdb.mdb /cmd " & CurrentDb.name
End Sub
Now when you call the CompactThisDB subroutine another database will open, the current database will close and be compacted.
There is no error checking and it is a little ugly at the minute and will not work with password protected files yet, but I will have a go at tarting it up later.
HTH
Ben ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web:
----------------------------------------