Compact Database

J

Jason Gyetko

I'm trying to use the Compact Database with Access 2000 from
http://www.mvps.org/access/general/gen0041.htm

Public Sub CompactDB()

CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction

End Sub

It works, but it then restarts my db after it's been initiated and my
switchboard form gets loaded again. Is there a way for it just compact and
exit, just as if I had check the 'Compact on Close' flag in the Options
menu? Is there a way to enable and disable the 'Compact on Close' option
from code? This way I just enable it, quit and I'm done. Thanks.
 
G

Guest

Roger,
I am using this sample, and am receiving this message box.
Item not found in this collection.

I have copied the function files and code. I have also checked the
references. What else should I check.

Many thanks,
David
 
G

Guest

I should clarify....
I am using Access 2002. In the database you created, this functionality
works fine on my computer.
I copied the 3 bas files, the function and the "on click" code into my
database. I am receiving the message below when executing the code in my
database.
 
R

Roger Carlson

Where is this error happening? In the first database or the second (that
is the one that's created then executed to compact the main database.)? You
might need to set a breakpoint and step through the code until you find
where it is happening. Since my sample works in A2002, I'm assuming the
basic notion works.

One thought is that the export also exports a form called
"frmCompactingDatabase" to the new database, which is opened just as user
feedback when the database is compacting. You might want to import that
form into your application as well (if you already haven't).

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
G

Guest

Roger,
Thank you for your response. It is just user issue. I was hoping the code
would magically determine the name of my backend database and linked tables.
I am finding that is not the case. I tried to change the references to
LinkRemote.mdb to my backend database, no luck so far... But I'll keep trying.

I think the help I need is beyond this forum's purpose.
 
R

Roger Carlson

Wait a second, are you trying to compact the Back-End or the Front-End? The
CompactDatabase.mdb sample is for compacting the Front-End. It is meant to
replace the "Compact On Close" feature of Access 2000 and up.

If you are compacting the Back-End, you might look at my sample called
"CompactBackEndDB.mdb". If you want it to automatically find Back-End where
the linked tables come from, look at my sample "GetPathFileName.mdb" and
look at the basFindSource module.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top