vba code access

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Vba code for access 2003 database 'compact and repair'

Vba code for access 2003 database 'compact and repair'

resolvedResolved · Low Priority · Version 2003

Russell has attended:
Access VBA course
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Vba code for access 2003 database 'compact and repair'

Can you please provide code for automating the compact and repair database procedure? The aim would be to link this to an on-click exit form button event:-
1) close form 2) compact and repair database 3) copy database to a date stamped archive directory 4) close application

RE: vba code for access 2003 database 'compact and repair'

Hi Russell,

Thank you for your question and welcome to the forum.

Try this piece of code:

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

This code should be the equivalent to using the Tools menu.

I hope this helps.

Regards

Simon

RE: vba code for access 2003 database 'compact and repair'

Thanks Simon, appreciated :)

Thu 15 Dec 2011: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Relationship maps

It is important to create proper relationships between tables. You can use Access to help check your designs and evaluate them by printing them in graphical format to help with design purposes


Click on the Tools menu, click Relationships.
On the File menu, click Print Relationships. View or print as required

View all Access hints and tips


Server loaded in 0.05 secs.