472,333 Members | 1,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Compact Database on Close - Good Idea or Not?

Greetings. I just discovered the 'Compact on Close' option in
Access-Tools-Options-General Tab. It certainly sounds like a smart
idea to me. But before I turn that option on I thought I'd check with
the experts to see if there are any reasons why I would not want to
'Compact on Close'. Can you think of any?

Thanks.

SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
5 9628
On Tue, 19 Apr 2005 15:17:02 GMT, Susan Bricker <sl*****@verizon.net> wrote:
Greetings. I just discovered the 'Compact on Close' option in
Access-Tools-Options-General Tab. It certainly sounds like a smart
idea to me. But before I turn that option on I thought I'd check with
the experts to see if there are any reasons why I would not want to
'Compact on Close'. Can you think of any?

Thanks.

SueB


The option can be useful for a stand-alone database, but it's not so useful
for a split front-end/back-end app (all of mine are). The reason is that
compact on close only closes the front-end database, and it's usually the
back-end that really needs the compacting.
Nov 13 '05 #2

Steve,

Thank you for the explanation. Is there a way (programatically) to
compact a back-end app? I do have an application (here at work) that is
split (back-end and front-end). Luckily, I have the ability and
authority to get to both and can manually compact them but it would be
great to have a command button or some action kick-off the database
compact routine. Do you have any ideas or suggestions?

SueB
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
Di
Hi Susan,
Most of my applications are separated front and backend due to
multiple users. To compact back end only, I use 2 methods:
1) Assign a time for compact and the first person who opens the
front end after that time takes the hit (ie the wait for backup and
repair).
2) Assign a volunteer :o) to do this via button.

To code using vba:

If you have multiple users, you must check if the database lock file
exists, if this exists the database will not compact as it is in use.

It would be a good idea to have a menu page in the UI/FE which is not
attached to any tables which users can back out to when they are not
entering data as most people do not like to close and reopen especially
if you have security, this will leave the backend free for compact.

If (Not (FileExists("filename.ldb"))) Then
DBEngine.CompactDatabase "Filename.mdb", Temp
FileCopy Temp, "Filename.mdb"
End If

This creates a compacted temp database and overwrites your existing BE
database with it. Remember to use :
If (FileExists(Temp)) Then
Kill Temp
End If
first to remove old copies of temp.

This works for me.
You can find good explanations, other methods and helpful code on
"http://www.mvps.org/access/"

Good Luck,
D...

Nov 13 '05 #4

Di,

Thanks much for the info. It looks like it will work for me, also.

SueB
*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
On Tue, 19 Apr 2005 15:31:04 GMT, Susan Bricker <sl*****@verizon.net>
wrote:

An alternative to Di's method works if your server machine is on at
all times, whereas the client machines are only on during the day.
This involves scheduling a Windows Task to run automatically at night,
using a command line like this:
<path to>msaccess.exe <path to>my.mdb /compact

-Tom.


Steve,

Thank you for the explanation. Is there a way (programatically) to
compact a back-end app? I do have an application (here at work) that is
split (back-end and front-end). Luckily, I have the ability and
authority to get to both and can manually compact them but it would be
great to have a command button or some action kick-off the database
compact routine. Do you have any ideas or suggestions?

SueB
*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Mike MacSween | last post by:
Is it?
13
by: James Franklin | last post by:
Hi, I have a number of databases in A2K, written on different machines with different installations of Office. I have found that compacting a...
13
by: Larry L | last post by:
Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works...
1
by: smitty mittlebaum | last post by:
I have a strange problem that has reared its ugly head in the last few weeks. I have the option "Compact on Close" (Tools, Options, General tab)...
4
by: Wayne | last post by:
Does "Compact On Close" do a "Compact and Repair" or just a compact. Is a compact necessary (or at least a good idea) on a regular basis, say...
1
by: robert demo via AccessMonster.com | last post by:
In my startup routine, I have the following code: s = CLng(FileLen(filespec) / 1000000) If s > 5 Then 'FIRST, BACKUP THE FRONT END If...
3
by: G Gerard | last post by:
Hello The more I use an application ( an mdb) created using MSAccess I notice that the Byte size of the application keeps on increasing....
29
by: Neil | last post by:
I would like to compact on close only if the database size goes over a certain amount, rather than each time. Thus, I'd like to check the file size...
2
by: BinaryGirl23 | last post by:
Hello, I'm having a bit of a problem regarding my back-end database for Access 2003. The db is set for shared mode, has no programming code at...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.