PC Review


Reply
Thread Tools Rate Thread

DBEngine.CompactDatabase vs Compact on Close

 
 
dch3
Guest
Posts: n/a
 
      8th Aug 2008
If I implement DBEngine.CompactDatabase when my database closes (as opposed
to the Compact on Close option), are there any caveates that I should be
aware of?

I want to give my users a message that the database is shutting down as
opposed to the Access Application Window just sitting there until the DB is
compacted.

I'm also fully aware that I'll have to build the code into an Exit routine
and then force the user's to Exit via the routine - I'm in the process of
implementing custom Menu Bars.
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      8th Aug 2008
I'd question doing either.

Your application should be split into a front-end (containing the queries,
forms, reports, macros and modules), linked to a back-end (containing the
tables and relationships). It's the back-end that needs compacting, and
Compact On Close only works on the "active" database (the front-end). If the
front-end becomes bloated, simply replace it with a new copy.

As well, I personally don't think it's a good idea to compact that
regularly. The decision to compact should be based on how much the database
has grown, or how much it's been used.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"dch3" <(E-Mail Removed)> wrote in message
news:CC37AE4C-7584-41A8-BCC3-(E-Mail Removed)...
> If I implement DBEngine.CompactDatabase when my database closes (as
> opposed
> to the Compact on Close option), are there any caveates that I should be
> aware of?
>
> I want to give my users a message that the database is shutting down as
> opposed to the Access Application Window just sitting there until the DB
> is
> compacted.
>
> I'm also fully aware that I'll have to build the code into an Exit routine
> and then force the user's to Exit via the routine - I'm in the process of
> implementing custom Menu Bars.



 
Reply With Quote
 
dch3
Guest
Posts: n/a
 
      8th Aug 2008
The database is split. However, there are several temp tables located in the
front end that are regularly appened to and then deleted. The nature of the
tables is such that they can't reside in the backend as they support a
user-based wizard. As such, a copy of the front end will be located on 30 or
so PC'S.

"Douglas J. Steele" wrote:

> I'd question doing either.
>
> Your application should be split into a front-end (containing the queries,
> forms, reports, macros and modules), linked to a back-end (containing the
> tables and relationships). It's the back-end that needs compacting, and
> Compact On Close only works on the "active" database (the front-end). If the
> front-end becomes bloated, simply replace it with a new copy.
>
> As well, I personally don't think it's a good idea to compact that
> regularly. The decision to compact should be based on how much the database
> has grown, or how much it's been used.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "dch3" <(E-Mail Removed)> wrote in message
> news:CC37AE4C-7584-41A8-BCC3-(E-Mail Removed)...
> > If I implement DBEngine.CompactDatabase when my database closes (as
> > opposed
> > to the Compact on Close option), are there any caveates that I should be
> > aware of?
> >
> > I want to give my users a message that the database is shutting down as
> > opposed to the Access Application Window just sitting there until the DB
> > is
> > compacted.
> >
> > I'm also fully aware that I'll have to build the code into an Exit routine
> > and then force the user's to Exit via the routine - I'm in the process of
> > implementing custom Menu Bars.

>
>
>

 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      9th Aug 2008
=?Utf-8?B?ZGNoMw==?= <(E-Mail Removed)> wrote in
news:3E52F28E-A8B2-4A29-A29D-(E-Mail Removed):

> The database is split. However, there are several temp tables
> located in the front end that are regularly appened to and then
> deleted. The nature of the tables is such that they can't reside
> in the backend as they support a user-based wizard.


Put the temp tables in another MDB, linked in your front end. Then
you can replace the temp MDB with a pristine copy with a file copy
operation, say, every time you close the app. Or, you can just leave
it alone (I started out replacing it on close, but now don't bother
at all).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
dch3
Guest
Posts: n/a
 
      9th Aug 2008
....and to think I've already been working on a VBScript file to automatically
check the front end on the server to see if its a newer version that the one
on the local machine.

"David W. Fenton" wrote:

> =?Utf-8?B?ZGNoMw==?= <(E-Mail Removed)> wrote in
> news:3E52F28E-A8B2-4A29-A29D-(E-Mail Removed):
>
> > The database is split. However, there are several temp tables
> > located in the front end that are regularly appened to and then
> > deleted. The nature of the tables is such that they can't reside
> > in the backend as they support a user-based wizard.

>
> Put the temp tables in another MDB, linked in your front end. Then
> you can replace the temp MDB with a pristine copy with a file copy
> operation, say, every time you close the app. Or, you can just leave
> it alone (I started out replacing it on close, but now don't bother
> at all).
>
> --
> David W. Fenton http://www.dfenton.com/
> usenet at dfenton dot com http://www.dfenton.com/DFA/
>

 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      10th Aug 2008
=?Utf-8?B?ZGNoMw==?= <(E-Mail Removed)> wrote in
news:543D8C69-33B8-4662-8A70-(E-Mail Removed):

> ...and to think I've already been working on a VBScript file to
> automatically check the front end on the server to see if its a
> newer version that the one on the local machine.


The only complication with this is distributing to a new location,
where you need to relink. If you place the tmp.mdb in the same
folder as the front end, it's easy. If you put it somewhere else, it
can be complicated. Because of that, I created my own reconnect
utility that manages reconnecting to multiple back ends easily:

http://dfenton.com/DFA/download/Access/Reconnect.html

All of my apps use this (because all my apps have temp tables).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
dch3
Guest
Posts: n/a
 
      10th Aug 2008
I was thinking about having the temp *.mdb in the same folder as the front
end. Somewhere, I've got code that extracts the full path to a file and was
going to use that to obtain the path to the front end folder (via the DB
property whose name I can't remember at the moment) and temp .mdb when I
reestablish the links if need be.



"David W. Fenton" wrote:

> =?Utf-8?B?ZGNoMw==?= <(E-Mail Removed)> wrote in
> news:543D8C69-33B8-4662-8A70-(E-Mail Removed):
>
> > ...and to think I've already been working on a VBScript file to
> > automatically check the front end on the server to see if its a
> > newer version that the one on the local machine.

>
> The only complication with this is distributing to a new location,
> where you need to relink. If you place the tmp.mdb in the same
> folder as the front end, it's easy. If you put it somewhere else, it
> can be complicated. Because of that, I created my own reconnect
> utility that manages reconnecting to multiple back ends easily:
>
> http://dfenton.com/DFA/download/Access/Reconnect.html
>
> All of my apps use this (because all my apps have temp tables).
>
> --
> David W. Fenton http://www.dfenton.com/
> usenet at dfenton dot com http://www.dfenton.com/DFA/
>

 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      11th Aug 2008
"Linq Adams via AccessMonster.com" <u28780@uwe> wrote in
news:8870eb434e626@uwe:

> Also be aware that many developers believe that, paradoxically,
> Compact & Repair is actually a source of repeated corruption! As
> such, C&R should only be done after making a backup copy of your
> database.


I don't know of anyone that believes a compact could actually
corrupt a database that is not already corrupt. It is possible for a
compact to make a silently corrupted database inaccessible, or it
could cause data loss in the compacted result. But that's not the
same thing at all as suggesting that the compact *caused* the
corruption. It simply flushed it out, or revealed what was
previously hidden.

Either way, it's essential that you have a backup before any compact
operation, regardless of what you think about the "dangers" of
compact.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DBEngine.CompactDatabase Compile Error: Argument not Optional M Skabialka Microsoft Access 1 1st May 2008 10:00 AM
DBEngine.CompactDatabase =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Access Form Coding 1 20th Apr 2007 06:21 PM
DBEngine.CompactDatabase and Permissions Anthony England Microsoft Access Security 19 26th Apr 2006 05:03 AM
Stopping Compact and Repair (and Compact on Close) - Records Disappear gee664@gmail.com Microsoft Access 7 25th Apr 2006 05:17 PM
Problem with DBEngine.CompactDatabase =?Utf-8?B?SGVyYmVydA==?= Microsoft Access VBA Modules 0 22nd Nov 2004 03:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:03 AM.