views:

1130

answers:

2

Hi,

I am using Access database. Now i compact the database by using DAO and sometimes using JRO. But to this both, we have add the COM reference.

I don't want to add the COM reference for compacting.

Is there any other way to compact an access database without using the COM reference(for DAO and JRO).

Kind help needed. Thanks.

Sivakumar.P

+1  A: 

If the user has Access installed on their machine you could shell out and use the command line Syntax.

Something like: MSACCESS.EXE /compact

It might help to understand why you don't want to include the COM reference to answer more appropriately though.

Further Reading: Access Command Line Reference

JohnFx
I used to use this for a project I worked on. Since the db was deployed with the app, I even has it run as part of the automated build script
Jacob Adams
+2  A: 

You could also try the Jet Compact utility: http://support.microsoft.com/kb/295334

This utility has a UI, but can also be called with command line switches:

jetcomp.exe -src:"C:\input.mdb" -dest:"output.mdb"

To get a full list of available switches:

jetcomp.exe -?
Chris John
Thanks Chris.Fine.
sivakumar