|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Compacting an access db from vbI use JRO (add a reference to Interop.JRO.Dll) and the following code
Private Sub CompactDatabase(ByVal Directory As String, ByVal Filename As String) ' Directory is the directory that contains the access database ' Compact Access Database Dim jro As JRO.JetEngine jro = New JRO.JetEngine If System.IO.File.Exists(Directory & "\New" & Filename) Then System.IO.File.Delete(Directory & "\New" & Filename) ' Check that there is no file called New + Filename Try jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Directory & "\" & Filename, _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Directory & "\New" & Filename & ";Jet OLEDB:Engine Type=5") ' Compacts the database into a new file beginning with "new" System.IO.File.Delete(Directory & "\" & Filename) ' Deletes the original database System.IO.File.Copy(Directory & "\New" & Filename, Directory & "\" & Filename, True) ' Copys across the New over the original System.IO.File.Delete(Directory & "\New" & Filename) ' Delete the New database Catch End Try End Sub Regards Simon -- Show quoteHide quote================================ Simon Verona Dealer Management Service Ltd Stewart House Centurion Business Park Julian Way Sheffield S9 1GD Tel: 0870 080 2300 Fax: 0870 735 0011 "reidarT" <rei***@eivon.no> wrote in message news:O7hs3JttGHA.4852@TK2MSFTNGP02.phx.gbl... > How can I copact and repair an accesws db from VB? > reidarT > >
1 Variable - 2 Forms
Co-existing ASP.NET 1.1 and 2.0??? Accessing Structure Members Communication between threads Transactions through Remoting Function doesn't return a value on all code paths Excel already runnig, how to update with VB Detect TcpClient Connection dropped Moving windows Mixer and Wave Audio App |
|||||||||||||||||||||||