Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[COMPACT] How to compact .mdb ?

Status
Not open for further replies.

yp56

Programmer
Joined
Aug 30, 2001
Messages
83
Location
FR
Hello,
I'm developping a java application wich is connected to an MS ACCESS datbase.
For now, I never compact the database but it would be better.
So, I wonder how to compact an Access database thought a .bat script (no gui since the user mustn't do it by itself) ?

thanks :)
 
\path\to\msaccess.exe" "\path\to\database.mdb" /compact

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Could open the Access fire with the '/repair' switch

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "\\ServerA\dbs\DBTool.mdb" /repair

Regards

Stephen
 
Can you call DAO from Java? If so, you can use DBEngine.CompactDatabase strDatabaseName, strBackupName

There's a VBA example on our web site if you search for "compact"

Geoff Franklin
 
I don't know how to call DAO objects from java and there is no MSAccess installed on the pc :(
 
is there any .exe programe which can compact an Access database from a .bat script (so with no gui) ?
 
thank you PHV :)
but I knew it. The problem is that it has a graphical User Interface. I can't compact the database automatically from a .bat script.
I can't tell the user to compact himself the database :(
 
It does have a GUI but the Handy Access Launcher might work for you. Once set up, it just sits in the user's System Tray and will compact, repair or run macros in your Access db's according to whatever schedule you define.

HAL can be found at
 
What is "Handy Access Launcher" (i don't understand).
If it is what PHV said :

"\path\to\msaccess.exe" "\path\to\database.mdb" /compact

I can't since the workstation hasn't got MS access installed. I only use ODBC connection throught java/jdbc
 
Why bother doing a compact/repair anyway? Most situations don't require this sort of thing, ever.
 
It is not what I heard. Compact will remove all temporary data and reorganize data pages and more things...
I'll try to do a little exe in VB which do it..
 
Why don't you use the "Data Source ODBC administrator" tool.
1- create DSN (datasource name) for your MDB file
2- create a shortcut on the desktop for the "Data Source ODBC Administrator"

Your client will only have to:
1- Launch the "Data Source ODBC Administrator" with the shortcut on the desktop.
2- Double-click on the DSN you create
3- Click on the "Compact" button.

Hope this help and excuse my english!!!
 
Handy Access Launcher is a piece of software specifically designed for scheduling macro runs, compacts and repairs for Access databases. It used to be freeware, but I htink it is now very-cheap-ware.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top