[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

What to do with this error when I run the macro Company and repair command button.

Posted on 2014-08-10
3
Medium Priority
?
249 Views
Last Modified: 2014-08-15
I get an error from this code:

Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

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

Exit_Command5_Click:
Exit Sub

Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click

End Sub
++++++++++++++++++++++++++++++++++++++++++

I found this code on line and thought it would work.

+++++++++++++++++++++++++++++++++++++++++++++

See attached image
Error-On-Compact-and-repair-macro.jpg
HBF-Modified-Root-Cause-Analysis-for-Tun
0
Comment
Question by:cssc1
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 40252299
The last time I checked, You cannot really use automation to C&R the current database.
...the only way to do this was with sendkeys:
See the solution here:
http://www.experts-exchange.com/Database/MS_Access/Q_28267874.html

JeffCoachman
0
 

Author Closing Comment

by:cssc1
ID: 40260656
thanks
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40264614
;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question