Compact and Repair Error

C

Chuck

I have a 2003 database. When I execute a Compact and Repair I receive the
message "You can't exit Microsoft Access now. If you are using a Visual Basic
module that is using OLE or DDE you may need to interrupt the module."
What do I need to do? Thanks
 
C

Clifford Bass

Hi Chuck,

Hold down the <Shift> key while opening the database. That should
prevent anything from running. Then try a compact and repair.

Clifford Bass
 
J

Jeff Boyce

Chuck

Before running C&R, make a backup copy, just in case.

Just in case, make two...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
C

Chuck

Thank you Clifford, that worked.
Will there be a issue if I turn on Compact on Close ?
Chuck
 
C

Clifford Bass

Hi Chuck,

You are welcome.

I would expect that you will have an issue with Compact on Close. You
may want to test. It may be possible that the compact will work in some
instances and not in others. So, if it works fine on first try, test it
after doing a number of activities.

Clifford Bass
 
T

Topeters O

I ran my compact code with the application close event and got the error. Can someone help with this?
Here's my code

'Turn off Access warning
DoCmd.SetWarnings False

'Append logout data to Logged User table
DoCmd.OpenQuery "qry_UpdateLogOut", acViewNormal
'Turn Access warning back on
DoCmd.SetWarnings True

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


'Exit application - The close event starts and closes all other open forms

DoCmd.Quit



Jeff Boyce wrote:

Re: Compact and Repair Error
03-Sep-09

Chuc

Before running C&R, make a backup copy, just in case

Just in case, make two..

Regard

Jeff Boyc
Microsoft Office/Access MV


EggHeadCafe - Software Developer Portal of Choice
Converting a Collection into a DataTable using Generics
http://www.eggheadcafe.com/tutorial...2-f919f2bd6a46/converting-a-collection-i.aspx
 
T

Topeters O

I ran my compact code with the application close event and got the error. Can someone help with this?
Here's my code

'Turn off Access warning
DoCmd.SetWarnings False

'Append logout data to Logged User table
DoCmd.OpenQuery "qry_UpdateLogOut", acViewNormal
'Turn Access warning back on
DoCmd.SetWarnings True

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


'Exit application - The close event starts and closes all other open forms

DoCmd.Quit



Jeff Boyce wrote:

Re: Compact and Repair Error
03-Sep-09

Chuc

Before running C&R, make a backup copy, just in case

Just in case, make two..

Regard

Jeff Boyc
Microsoft Office/Access MV


EggHeadCafe - Software Developer Portal of Choice
Run the command or application in the Security context of specified user
http://www.eggheadcafe.com/tutorial...2-cd97ef257c99/run-the-command-or-applic.aspx
 
C

Clifford Bass

Hi,

Last I remembered, you cannot execute the compact and repair from
within code because it requires all code be stopped, and by definition it is
still running when you try to do it in code. I usually set up my front ends
to compact-on-close through the Access setting for the database. For the
back end you can set up something that does a scheduled compact and repair
when no one is in it.

Clifford Bass
 

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