compacting database

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Someone posted about compacting a backend file from within the front end. I
have had at least a 99% failure rate doing it this way. However, using
Tools - compact works but is a manual task.
 
Jason said:
Someone posted about compacting a backend file from within the front end.
I have had at least a 99% failure rate doing it this way. However, using
Tools - compact works but is a manual task.

Have you tried:

DBEngine.CompactDatabase "F:\yourdir\oldname.mdb", "F:\yourdir\newname.mdb",

or to the same name:

DBEngine.CompactDatabase "F:\yourdir\oldname.mdb", "F:\yourdir\oldname.mdb"
 
Can not companct database to same name - Access comes up with an error.
However, I'll try it when I get time to.
 
How do I delete the existing mdb file and rename the compacted file within
access?

Thanks,
J.
 
Thanks,
Was using the kill and filecopy to temp directory - therefore didn't need
name but I might actually use name in the current directory that would mean
the process would be faster.
 
are you sure it is name as this is usually Form.name:
did f1 on name and found that it is supposed to be as instead of comma/

Is there facility to move also?
Thanks,
 
I think I read that if the back-end has the option Compact On Close, then
the last front end to exit will cause the back end to compact. Never tried
this and perhaps could be overkill.

John
 
You have to look in the VBA IDE help for help on VBA code:

Description:
Moves one or more files from one location to another.

Syntax:
object.MoveFile source, destination

The MoveFile method syntax has these parts:

Part Description
object Required. Always the name of a FileSystemObject.

source Required. The path to the file or files to be moved. The source
argument string can contain wildcard characters in the last path component
only.

destination Required. The path where the file or files are to be
moved. The destination argument can't contain wildcard characters.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Please explain IDE help. Would this work like explorers move where when
moved on the same partition it takes no where as long as copying?
Thanks,
 
Back
Top