compacting database

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.
 
A

Arvin Meyer [MVP]

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"
 
J

Jason

Can not companct database to same name - Access comes up with an error.
However, I'll try it when I get time to.
 
J

Jason

How do I delete the existing mdb file and rename the compacted file within
access?

Thanks,
J.
 
J

Jason

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.
 
J

Jason

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,
 
J

JohnC

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
 
A

Arvin Meyer [MVP]

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
 
J

Jason

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,
 

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

Top