Compact And Repair Database

A

A.M

Hi,

How can i compact and repair a .MDB file through a macro ?
I already know how to do that using menu iterface.

Thanks,
Ali
 
A

Alick [MSFT]

Hi Ali,

Please refer to the article to resolve the issue.

ACC: Sample Macro for Compacting and Repairing a Database
http://support.microsoft.com/?id=100923


Sincerely,

Alick Ye, MCSD
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



--------------------
| From: "A.M" <[email protected]>
| Subject: Compact And Repair Database
| Date: Wed, 24 Sep 2003 14:08:41 -0400
| X-Tomcat-NG: microsoft.public.access.macros
|
| Hi,
|
| How can i compact and repair a .MDB file through a macro ?
| I already know how to do that using menu iterface.
|
| Thanks,
| Ali
|
|
|
 
J

Jim/Chris

You Can't. However you can compact/repair database on
exiting the application. A check box is located in the
tools/options general tab.

Jim
 
A

Alick [MSFT]

Hi Ali,

If you mean compact and repair the current open database which the code
runs in, it can't be done except the check box Jim mentioned. However, we
can compact and repair other database file, if you want to repair other
database instead of the current open database, you can refer to
RepairDatabase Method Example in Access help file, cited below for your
convenience:

RepairDatabase Method Example

This example attempts to repair the database named Northwind.mdb. You
cannot run this procedure from a module within Northwind.mdb.

Sub RepairDatabaseX()

Dim errLoop As Error

If MsgBox("Repair the Northwind database?", _
vbYesNo) = vbYes Then
On Error GoTo Err_Repair
DBEngine.RepairDatabase "Northwind.mdb"
On Error GoTo 0
MsgBox "End of repair procedure!"
End If

Exit Sub

Err_Repair:

For Each errLoop In DBEngine.Errors
MsgBox "Repair unsuccessful!" & vbCr & _
"Error number: " & errLoop.Number & _
vbCr & errLoop.Description
Next errLoop

End Sub


Sincerely,

Alick Ye, MCSD
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| X-Tomcat-NG: microsoft.public.access.macros
|
| Hi,
|
| How can i compact and repair a .MDB file through a macro ?
| I already know how to do that using menu iterface.
|
| Thanks,
| Ali
|
|
|
 
M

m wark

Ali,

I just posted this same question today... Did you ever
find out how to do this?

m
 
H

Hafeez Esmail

Thanks Jim!!
-----Original Message-----
You Can't. However you can compact/repair database on
exiting the application. A check box is located in the
tools/options general tab.

Jim
.
 

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