473,406 Members | 2,390 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,406 software developers and data experts.

Compact / Compress OnClose

675 512MB
Access has an option for Compact on Close. Very good, as that should stop a major increase in size every time any .mdb file is used by Access.

My question is, Is this safe? It used to be that I would make a backup copy before I tried to compress. So now I can do it automatically, without a backup copy and without having to teach users about this procedure, and what it all means.

I use Outlook Express, and it reached 2GB, and failed. I find I was supposed to be doing a compress occasionally. I didn't realize this, and I'm sure most users are not aware that this is a database program, and needs to be compacted.

So if Microsoft does not do an automatic compact for Outlook Express, can I trust the Compact at Close for Access?

OldBirdman
Jan 4 '08 #1
13 2558
missinglinq
3,532 Expert 2GB
Please stop using term compress and stick with compact! Compress is both confusing and inaccurate!

Using the Compact on Close option has often been cited as a cause of corruption in Access databases. I've seen these reports often enough that I never use the option and always backup before compacting. Your choice!

Now, about Outlook Express. The reason "most users are not aware that this is a database program" is very simple; it's not a database program, it's an email program!

Yes, it's recommended that you compact the files from time to time. Unlike web-based email programs, where your messages are stored on the email servers, with OE the messages are stored on your hard drive. Compacting is recommended in order to save storage space on your PC, not because there is a 2 GB limit as is true with Access. There are a number of reasons why it becomes corrupted. One of the biggest, user induced causes is interrupting the compact process once it has started! Another is, ironically, email scanning anti-virus programs.

Here are two excellent links that explain the ins and outs of Outlook Express compacting as well as a comprehensive overview all the causes of corruption/poor performence in it.

http://email.about.com/od/outlookexp...compact_oe.htm

http://www.microsoft.com/windows/ie/...ption.mspx#EEB

Linq ;0)>
Jan 4 '08 #2
NeoPa
32,556 Expert Mod 16PB
As Linq says - I'd be wary of using the CompactOnClose option. I always use the Compact option without a database open. This way it asks for source and destination database names (inbuilt backup of course).
I also get mine to work from a command button in my database for the standard ones.
Expand|Select|Wrap|Line Numbers
  1. 'CompactDb compacts a remote Access database.
  2. Public Function CompactDb(ByVal strDB As String, _
  3.                           Optional strPW As String = "") As Boolean
  4.     Dim strNewDB As String, strLocale As String
  5.  
  6.     On Error GoTo ErrorCDB
  7.     strNewDB = Replace(strDB, ".Mdb", "New.Mdb")
  8.     Call Echo(True, "Compacting """ & strDB & """.")
  9.     If strPW <> "" Then strLocale = ";pwd=" & strPW
  10.     If Exist(strNewDB) Then Kill strNewDB
  11.     Call DBEngine.CompactDatabase(SrcName:=strDB, _
  12.                                   DstName:=strNewDB, _
  13.                                   DstLocale:=strLocale, _
  14.                                   SrcLocale:=strLocale)
  15.     Kill strDB
  16.     Name strNewDB As strDB
  17.     Call Echo(True, """" & strDB & """ compacted.")
  18.     CompactDb = True
  19.     Exit Function
  20.  
  21. ErrorCDB:
  22.     CompactDb = False
  23. End Function
I'm interested in your comments though Linq.
Certainly OE is an email client - as is Outlook. I can't speak for OE as I never use it but Outlook (when using Personal Storage .Pst files) certainly accesses a database as that is exactly what a PST file is. Not fully fledged Access of course, but certainly constrained to the 2GB limit that Access 2K files are.
Compacting these files (from within Outlook rather than Access) can release free space but how much tends to depend on the pattern of usage of the owner. It's always worth doing after a major cleardown of old cr*p though.
Jan 4 '08 #3
ADezii
8,834 Expert 8TB
As Linq says - I'd be wary of using the CompactOnClose option. I always use the Compact option without a database open. This way it asks for source and destination database names (inbuilt backup of course).
I also get mine to work from a command button in my database for the standard ones.
Expand|Select|Wrap|Line Numbers
  1. 'CompactDb compacts a remote Access database.
  2. Public Function CompactDb(ByVal strDB As String, _
  3.                           Optional strPW As String = "") As Boolean
  4.     Dim strNewDB As String, strLocale As String
  5.  
  6.     On Error GoTo ErrorCDB
  7.     strNewDB = Replace(strDB, ".Mdb", "New.Mdb")
  8.     Call Echo(True, "Compacting """ & strDB & """.")
  9.     If strPW <> "" Then strLocale = ";pwd=" & strPW
  10.     If Exist(strNewDB) Then Kill strNewDB
  11.     Call DBEngine.CompactDatabase(SrcName:=strDB, _
  12.                                   DstName:=strNewDB, _
  13.                                   DstLocale:=strLocale, _
  14.                                   SrcLocale:=strLocale)
  15.     Kill strDB
  16.     Name strNewDB As strDB
  17.     Call Echo(True, """" & strDB & """ compacted.")
  18.     CompactDb = True
  19.     Exit Function
  20.  
  21. ErrorCDB:
  22.     CompactDb = False
  23. End Function
I'm interested in your comments though Linq.
Certainly OE is an email client - as is Outlook. I can't speak for OE as I never use it but Outlook (when using Personal Storage .Pst files) certainly accesses a database as that is exactly what a PST file is. Not fully fledged Access of course, but certainly constrained to the 2GB limit that Access 2K files are.
Compacting these files (from within Outlook rather than Access) can release free space but how much tends to depend on the pattern of usage of the owner. It's always worth doing after a major cleardown of old cr*p though.
I think that one important point to mention in concert with Compaction is Defragging of the Hard Drive. After Compacting the DB, you would want the data to reside in contiguous Sectors on the Drive. Agreed?
Jan 4 '08 #4
missinglinq
3,532 Expert 2GB
From what I understand, I think you're assuming that Outlook Express is a limited subset of Outlook, and that isn't true! One of the links I posted takes pain to explain this. In short, the rules for one have nothing to do with the other, despite the common name Outlook! They're really two totally different programs! Another one of MS's cute little tricks! OE doesn't use .pst files, but rather .dbx files!

As to ADezii's suggestion of defragging after compacting the files, that certainly makes sense to me. I don't know about Outlook, but Outlook Express actually prompts the user to compact approximately every 100 times the program is opened, depending, as I understand it, on individual usage.


Linq ;0)>
Jan 4 '08 #5
NeoPa
32,556 Expert Mod 16PB
I think that one important point to mention in concert with Compaction is Defragging of the Hard Drive. After Compacting the DB, you would want the data to reside in contiguous Sectors on the Drive. Agreed?
Probably one of the few places (large databses) where defragging can actually help noticeably.
Most tests (other than by those quoted by defrag software companies) indicate that while it never slows things down, the actual practical increase is almost always minimal.
Database files though, are probably the ones most affected by being stored contiguously.
Jan 5 '08 #6
ADezii
8,834 Expert 8TB
Probably one of the few places (large databses) where defragging can actually help noticeably.
Most tests (other than by those quoted by defrag software companies) indicate that while it never slows things down, the actual practical increase is almost always minimal.
Database files though, are probably the ones most affected by being stored contiguously.
Interesting, NeoPa. I would think that restricting the movements of the Read/Write Heads would have more than a 'minimal' effect on performance.
Jan 5 '08 #7
NeoPa
32,556 Expert Mod 16PB
From what I understand, I think you're assuming that Outlook Express is a limited subset of Outlook, and that isn't true! One of the links I posted takes pain to explain this. In short, the rules for one have nothing to do with the other, despite the common name Outlook! They're really two totally different programs! Another one of MS's cute little tricks! OE doesn't use .pst files, but rather .dbx files!
...
This is something I was aware of (at a basic level) but I wasn't aware exactly where the similarities ended.
.PST & .DBX are probably not related except in as much as they are probably both database format files. Not necessarily a standard or specified format, but as they have to be able to store many and varied items within them and access them in a timely manner, they surely bare being referred to as databases.
That doesn't make Outlook or Outlook Express database programs, or even RDBMS systems. However, they do have database manipulation elements in them.
As your link pointed out (after your last post I had to go and read it properly :() these files need to be compacted from time to time to allow them to work efficiently, clearing away the dead wood.
Jan 5 '08 #8
NeoPa
32,556 Expert Mod 16PB
Interesting, NeoPa. I would think that restricting the movements of the Read/Write Heads would have more than a 'minimal' effect on performance.
You and me both ADezii (not to mention various theoreticians). If my recollection of what I've heard about it is correct though, many of the expected improvements were cancelled out by other concepts already in place designed to improve performance. Particularly the caching.
If I had a better understanding of all the issues I'd explain more. Unfortunately all I can do is flag up the point and if anyone's interested they can dig. Good luck though, as most of what you'll find is by those with vested interests.
Jan 5 '08 #9
OldBirdman
675 512MB
Hey, this discussion is interesting, but not really going where I wanted it to go. The key question here is "How safe is an automatic 'Compact on Close'".

Every time I open an .mdb file, it increases by ~10%, whether I do anything or not. Maybe even more.

I mentioned Outlook Express only because it appeared to be a database program, and had a 'Compact' option, altho not mentioned in the simple help supplied.

Occasionally I find database programs inserted in my file structure (MS Exploring).

Apparently all database systems need compacting. My question was "Is an automatic compact safe"?

Outlook Express stores all email in files with the extension .DBX. Outlook Express needs to be compacted occasionally. Why was I in error assuming that OE is a database program? It most certainly is, and rightly so.

Whether OE is a subset of Outlook is academic, and we should not consider it on this thread.

Defrag is another subject completely. I have 80g on my harddrive, and I use about 10 g. What will defrag do for me. Answer: NOTHING. That isn't the question presented here.

Going back to the original question:
Is "Compact at Close" safe?

OldBirdman
Jan 10 '08 #10
zaidlig
45
Compact on Close is very safe if your database has no data or is not shared (multi-user). The best way to make an Access database uncrashable (in a multi-user environment) is use the Database Splitter under "Tools" this will split the data from the rest of the code. Then you can use Compact on Close without any issues, ever. This is also the most effective way to use Access even if its not muti-user, but stored on a network drive since all the user objects are local not being called over the network. All data transactions happen in realtime at the close of the record and it reports if a record write is not complete. In 10 years of creating a running 100's of databases I've lost only one record (it was later determined to be a drive failure) not a database error.
Jan 10 '08 #11
NeoPa
32,556 Expert Mod 16PB
Sorry to let the discussion get off topic OB.
I didn't cover the question further as I felt that the question had been covered in posts #2 & #3 (I'd expressed my opinion at least).
Not all experts agree clearly (see previous post - #9), but you can choose from the info posted how you would like to proceed.
Jan 10 '08 #12
OldBirdman
675 512MB
Previous post #11 seems to get to the very heart of this question. He has a claim of being knowledgable with 10 years experience working with databases.

I have split some databases in the past, even for one user, stand-alone systems. This makes syncronizing 2 computers much faster, as only some tables are changed frequently, and some are almost never changed.

The links/references in post #2 are interesting. In the Microsoft article, although the word 'database' does not appear anywhere in the article, the word database could replace the word dbx every place that dbx is not used as a file extension. The article would then fully describe a database program, with each table (folder) being stored in a separate file. So this program has been "Split".

I guess the thing to do is what Microsoft does. It asks to compact the files after every 100 times the program is closed. Any warnings about shutting off the computer before this is done could be issued. Combining this with the code supplied by NeoPa would further reduce the risk.

Then at startup "If Exist(strNewDB) Then . . ." should detect if the compact was not completed, and appropriate action could be taken.

OldBirdman
Jan 12 '08 #13
NeoPa
32,556 Expert Mod 16PB
Sounds like a plan :)
Jan 14 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Matt Kruse | last post by:
I am far from a PHP expert, and I've been struggling to create a function which will take a javascript .js file and "compact" it as much as possible. Meaning, remove all comments and unnecessary...
1
by: Sue | last post by:
For lob data is it a good idea to both compact and apply system compression? I understand compact can reduce performance when updating but any disadvantages of using compress? Will it help to save...
2
by: amywolfie | last post by:
I have a series of 100 select queries (each represents a separate business rule). Each is run after a rule is tested. OnClose of each query, I need to run a report with only the results of...
4
by: Untitled | last post by:
Is there a component that i could use to automatically compact (remove white spaces, new lines maybe, etc..) the rendered HTML pages? When writing HTML, developers like to add spaces and newlines...
4
by: Al | last post by:
Hi I need to save lots of images on potentially very large database. Therefore the storage space is very crucial. I need what is most compact way to save an image. Currently I am using something...
6
by: Luke Matuszewski | last post by:
As in topic... has anyone used it ? I tried to use it but i guess i failed... here is a code: <html> <head> <title></title> <script type="text/javascript"> function closedWin() {...
4
by: Eitan M | last post by:
Hello, I have Access 2000 database. For some reasons, sometimes I add records to the DB and sometimes I delete records. When deleting records, I see that the "DB" keep the space on the db,...
43
by: perryche | last post by:
I have searched the site and probably came across dozens of posts... I am somewhat confused about the replies... here is my situation, see if someone can point me to where to go: I have splitted...
10
by: kpfunf | last post by:
I have an OnClose function that opens a switchboard (SwitchOpen). This function is placed in numerous objects' (reports and forms) OnClose event, and works great. However, a very annoying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.