Path for Runtime Compact/Repair

R

Rick_C

I have developed a runtime application where the user can place the data file
on a server. The ICON that I included is looking for the data on the C: to
compact / repair. It does not seem to be working. I would appreciate if
someone would provide me with the correct path (Target) for the ICON.

The file name is wtsdata.mdb
The location is: M:\Wts_Data\wtsdata.mdb

Thank you in advance for responses.

Rick
 
D

Douglas J. Steele

What else have you specified?

The command line needs to be something like:

<complete path to msaccess.exe> "M:\Wts_Data\wtsdata.mdb" /compact

However, I'd advise very strongly not to do that, as that will attempt to
compact the database to the original name and folder, which could leave you
out of the water if something goes wrong with the compact.

Better, in my opinion, is to rename the existing file, then compact the
renamed file to the original file name. You could do this by using a batch
file:

IF EXIST "M:\Wts_Data\wtsdata.bak" DEL "M:\Wts_Data\wtsdata.bak"
RENAME "M:\Wts_Data\wtsdata.mdb" wtsdata.bak
<complete path to msaccess.exe> "M:\Wts_Data\wtsdata.bak" /compact
"M:\Wts_Data\wtsdata.mdb"
 
R

Rick_C

Thank you Doug,

Actually I want it strictly for a REPAIR. I agree with the problems of doing
a compact. This is only if the data is corrupt.

Would this still apply?

Thanks...

Rick
 
D

Douglas J. Steele

Since there's only a single CompactRepair method in Access, you can't do
just a Repair. (There was a RepairDatabase method of the DBEngine object,
but Access 97 was the last version to have that separate method)
 
G

Guest

For example, if you run out of space, single file compact/
repair might delete your old file without having created
your new file.

Much better to Rename the file (as shown), and delete
the old file only after you have tested the new file.
 
Top