|
|
|
Following code requires Microsoft DAO 3.6 reference.
To add this reference goto Project->Reference
example: |
Click here to copy the following block |
Public Function DBCompact(ByVal DBSource As String, Optional ByVal DBTemp As String = "C:\CSITmp.mdb", Optional ByVal DstLocale As String = "", Optional ByVal Options As String = dbEncrypt, Optional ByVal Password As String = ";pwd=") On Error GoTo CompactError DBs = DBSource: DBs2 = DBTemp: DBLocale = DstLocale DBOptions = Options: DBPassword = Password If Dir(DBs) = "" Or DBs = "" Then MessageBox "Database Was Not Located.", vbExclamation, "DB Error" Else DBEngine.CompactDatabase DBs, DBs2, DBLocale, DBOptions, DBPassword Kill DBs DBEngine.CompactDatabase DBs2, DBs, DBLocale, DBOptions, DBPassword Kill DBs2 End If Exit Function CompactError: MessageBox "Error Compacting Database. Make Sure Database Is Closed." & vbCrLf & vbCrLf & Err.Number, vbExclamation, "Compact Error" End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|