Path for Runtime Compact/Repair

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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"
 
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
 
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)
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top