dbTalk Databases Forums  

Compacting a code database upon application exit (with an Access 2003 MDE)

comp.databases.ms-access comp.databases.ms-access


Discuss Compacting a code database upon application exit (with an Access 2003 MDE) in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Compacting a code database upon application exit (with an Access 2003 MDE) - 11-18-2011 , 02:23 PM






"Stuart McCall" <smccall (AT) myunrealbox (DOT) com> wrote

<snip>
Quote:
No need to go to all that trouble. Keep a spare, empty copy of the db,
called (eg) <DbName>_Original.mdb. When your app terminates, delete the
current <DbName.mdb> using the Kill command, and make a copy of the
original, using the FileCopy command:

FileCopy "<DbName>_Original.mdb", ""<DbName>.mdb"

(replace <DbName> with the name of your mdb, of course)


Wouldn't dbname.mdb be in use?

Sorry, I missed that you were talking about a FE. In that case, use a
batch file to start the FE, followed by:

DEL "dbname.mdb"
COPY "dbname_original.mdb" "dbname.mdb"

(including paths if necessary)

So a complete batch file might look something like:

@echo off
"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE"
DEL "C:\FE Folder\dbname.mdb"
COPY "C:\FE Folder\dbname_original.mdb" "C:\FE Folder\dbname.mdb"

Hope that helps
Actually it would probably be better to replace the mdb before starting it:

@echo off
DEL "C:\FE Folder\dbname.mdb"
COPY "C:\FE Folder\dbname_original.mdb" "C:\FE Folder\dbname.mdb"
"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "C:\FE
Folder\dbname.mdb"

(also I missed out the source mdb from the starting command, corrected
above. Watch out for word wrap. There are 4 lines of code there)

Reply With Quote
  #12  
Old   
ron paii
 
Posts: n/a

Default Re: Compacting a code database upon application exit (with an Access 2003 MDE) - 11-18-2011 , 04:08 PM






"PW" <emailaddyinsig (AT) ifIremember (DOT) com> wrote

Quote:
On Fri, 18 Nov 2011 08:34:58 -0000, "Stuart McCall"
smccall (AT) myunrealbox (DOT) com> wrote:

"PW" <emailaddyinsig (AT) ifIremember (DOT) com> wrote in message
news:65jbc7565hic48g0vi6erinoidmagcm7va (AT) 4ax (DOT) com...
On Thu, 17 Nov 2011 16:02:24 -0700, Tony Toews
ttoews (AT) telusplanet (DOT) net> wrote:

On Thu, 17 Nov 2011 12:23:53 -0700, PW
emailaddyinsig (AT) ifIremember (DOT) com> wrote:

Queries do use storage in the database that contains the query, and,
as
has
been stated for many releases, storage used (not just records) is
recovered
by compacting. Many of us have experienced growth of a 'front end'
database
when we execute queries, but, in my experience, that growth was not
'excessive'. My experience with 'excessive' growth has been with
databases
containing tables and subject to heavy update and deletion activity

Ah ha! Just as I suspected. It is interesting watching this size of
the front end keep increasing the more I run the queries. It's at
30KB to begin with, then increases up to 720 depending on how many
times I run the form. I assume that would keep on increasing.

I've noticed a 20 Mb front end increasing 1 or 2 Mb and then settling
down.

Not a mere 1 or 2 MB increase. And it doesn't settle down.


I'll second Doug's suggestion about using a temporary _database_ to
contain
your temporary tables, as documented on Tony Toew's site.

Will do! But won't that database also keep increasing in size?

Delete it when you're done or when the user exits the FE. Creating
an MDB, along with tables and indexes, on a local hard drive is so
fast you won't even notice it.

Tony

Delete the database? Recreate all the tables in code each time the
form is run? What about all the queries, which is the problem?

-pw

No need to go to all that trouble. Keep a spare, empty copy of the db,
called (eg) <DbName>_Original.mdb. When your app terminates, delete the
current <DbName.mdb> using the Kill command, and make a copy of the
original, using the FileCopy command:

FileCopy "<DbName>_Original.mdb", ""<DbName>.mdb"

(replace <DbName> with the name of your mdb, of course)


Wouldn't dbname.mdb be in use?
Unless your startup form references the temp mdb file, it won't be in use. I
have an FE that checks for it's temp.mdb on startup and copies from the
network if not found.

Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.