compact and repair
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Compact and Repair

Compact and Repair

resolvedResolved · Low Priority · Version 2003

replyReplyFri 25 Sep 2009, 15:19Delegate Ashley said...

Compact and Repair

I am often automating a large number of queries and table buildings in Access VBA and setting these to run in code. After building each main table I need to compact and repair before automatically running the next set, although the warnings within access can be turned off (query x will update y number of rows etc) there is a message during the compact and repair saying something like 'database cannot save whilst vba open' which i cant seem to turn off and means i cant leave my processing to run and go get a coffee as i would like!

Many Thanks

For upcoming training course dates see: Pricing & availability

replyReplyWed 30 Sep 2009, 14:38 Edited on Wed 30 Sep 2009, 14:39Trainer Stephen said...

RE: Compact and Repair

Hi Ashley

Thanks for your question

After some research I have found the following code which compacts and repairs the data base with no warning or error messages.

I suggest running it first on a test database, and then backing up the main database before you try using it. If this doesn't work, please feel free to get back to me

Public Sub Compacter()

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

End Sub


Regards

Stephen

replyReplyThu 1 Oct 2009, 10:00Delegate Ashley said...

RE: Compact and Repair

I tried implementing your code however despite it being different to what i had written out the same problem occurs. The Error message I recieve is the following:

'You Can't Compact the running database whilst running a macro or visual basic code'

I understand that the code you provided seeks to simulate the rest of the error message by getting the VBA to think it is clicking on the button within Access however it still see's it as VBA being run.

I have tried running the Processing module both directly from the code and by closing the VBA window and running the processing directly from a macro in Access.

Its not the end of the world if it cant be done automatically, its just a nice to have as would keep the file sizes down and speed the processing up a little.

Many Thanks

replyReplySun 22 Nov 2009, 11:36Trainer Stephen said...

RE: Compact and Repair

Hi Ashley

Thanks for the followup

First I apologise for the delay in responding to you.

After reviewing the problem, I can find no easy method to do this using code

However, it is of course possible to set the database so that it automatically compacts on closing.
Simply go to Tools-Options-General)to automatically compact upon closing.

Would this meet your needs?

Regards

Stephen

replyReplyMon 23 Nov 2009, 08:08Delegate Ashley said...

RE: Compact and Repair

Stephen,

Thanks for the response, I have been running the Compact and Repair from VBA at the end of my processing for a while and its not been too much of a problem, just a shame it cant c&r automatically part way through some things as i can see the process bar getting slower and slower over time.

Many thanks for looking into the problem for me

Ashley

 

 

Please browse our web site to find out more about
training database microsoft access and other Microsoft training courses.

Access tip:

Compact database automoatically

To ensure optimal performance, you should compact and repair your

Open the Access database or Access project that you want Access to compact automatically.
On the Tools menu, click Options.
Click the General tab.
Select the Compact on Close check box.

View all Access hints and tips

forum postHi, please could you let me know how to create a bar chart using 3 sets of data. e.g. the bottom axis would have the categories O&G, M&M, Chemicals, Utilities, up the side would be the numbers, but i want to split the bars up into different colou..

» Forum post: Charts using 3 sets of data


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training