First guess is bad path and file names. Make a copy of the source db and
name it a.mdb. Put it in the root directory of C:\. Run this code in an
Access 97 module:
DAO.DBEngine.CompactDatabase "C:\a.mdb", "C:\a_cmpact.mdb"
Does that work? If it doesn't, try a Windows shortcut with the /compact
switch. Make sure you use the full path to Access 97 and the full path to
the db. Example (all one line):
"C:\Program Files\Microsoft Office\OFFICE97\Msaccess.exe" "C:\database\db1.
mdb" /compact
Does that work?
Second guess is the DAO350.DLL needs to be reregistered.
Regsvr32.exe "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO350.DLL"
I just had a thought. The source db you're trying to compact in Access 97
*is* an Access 97/Jet 3.5 db, right? Not a Jet 4.0 db?
Chris
Microsoft MVP
Owen Jenkins wrote:
>I have Access 97, 2000 and 2003 all running on a Win XP box after having
just reinstalled XP. Among other problems, I find that Access 97 will
not compact a database in code ...
DBEngine.CompactDatabase dbSource, dbDestination
.. instead giving error 3001 - Invalid Argument. It worked happily prior
to the XP reinstall. (I have uninstalled all versions and reinstalled
again to no effect.)
This is the same problem I had a few years back with an older laptop.
See thread
http://groups.google.com.au/group/co...03906208091269
I didn't solve the problem then, and haven't found any more info in this
group since.
Anyone have any idea how I can get my Access 97 compact function back?
Owen Jenkins
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200805/1