473,382 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 9705
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 database while it is open regularly fails, seemingly...
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 great. Now after everyone's advice I split my...
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) enabled on my development machine. I did this...
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 weekly, for a database that has several hundred records...
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 BackupFrontEnd = False Then Exit Function 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. Once in a while I do a Compact and Repair Database...
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 and then perform the compact through code as the...
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 all, only back-end tables that is shared on our...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.