Té said:
What is the purpose of compact and repair? How exactly does it minimize
errors and reduce the file size?
When an access file is in use, it can't recover or delete free space.
Think of access as being a like word document, but SEVERAL people can use it
at the same time. If you were to delete a row (one line of text) in your
word document, then everything would move up.
So, for reason of performance record deletes don't actually recover disk
space. The deleted data is left "in place" in the file. (not to split hairs,
but the data is in the file, but you have no way of really seeing that
deleted data anymore).
It turns out that the same occurs for when you modify a form in design mode.
Ms-access leaves a copy of the old form, and saves the edited form by
expanding the database file (it can't delete the old one just like MS access
is unable to delete old data to fill up those holes). This means during the
day when you're doing a lot of developing a lot of modifications to forms,
you'll find that the application will grow in size VERY much. The common
term used in these newsgroups is the file will "bloat" in size very quickly.
The result of the above information understanding have how MS access works
is the following:
In your software designs , you want to avoid the use tempting tables.
Often, it is tempting for ease of reporting to send data out to a temporary
table, and then run the report on that table. However, since when you add
records to that table, the file size will grow, but when you delete records
(and even the table), the disk space and file size will NOT be recovered
until you do a compact and repair.
So, if you don't want your file size to grow like crazy, then as overall
design ideal, you thus want to avoid designs and coding practices that
create temporary tables or designs that copy/write out data and delete the
old data for no good reason at all. The less temporary tables and less
deleting of records means that your have less file growth. And, less file
growth will thus reduce the need to compact and repair on a frequent bases.
Ms-access works this way to keep performance high. If I have for example
100,000 records in a table, and you deleted the 1st record, then the moving
down the 99,999 records to fill that hole (gap) on the ms-access file would
take a LONG TIME to fill. And, during that move operation, no one else could
use the data file at the same time. (became the location of records is
changing inside of that mdb file). So, during a compact and repair
operation, no one else can be using the data file. Thus, compact and repair
is often scheduled to be done during the evening, or off hours when the
users of the application will not be impacted.
The backup database, when you make changes to the original file, does the
backup update also?
There is no backup database in ms-access. So, you have one file. Because
ms-access does not have a recovery file, then you should backup the data on
a daily basis. So, the answer is no, the backup does not get updated because
there is no backup file.
You might want to recheck or try to ascertain what this other backup file
you're talking about is? MS access does not create them for you
automatically or during regular use. The moral of this lesson is simply put,
you must have a frequent backup plan here. Lkely on a daily basis is the way
to go here. If you don't have backups of your data, then you're asking for
trouble with MS access.