IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » beccoblu's snipts » ado The latest ado snipts from beccoblu.

showing 1-1 of 1 snipts for ado
  • VB6: Compact Access DB with ADO
    Public Function DbCompact(oldDb As String, Optional bakDb As String = "") As Integer
    
      'Needs Microsoft Jet and Replication Objects Library
      'Needs Microsoft ActiveX Data Objects Library
      'Needs Microsoft Scripting Runtime
    
      'Returns 0 if OK, -1 if FAIL
    
      DbCompact = -1
    
      On Error GoTo noDbOk
    
      Dim j As JetEngine
      Dim fso As FileSystemObject
      Dim jStr As String, newDb As String
    
      Set fso = New FileSystemObject
      If Not fso.FileExists(oldDb) Then Exit Sub
    
      Set j = New JetEngine
    
      jStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
      newDb = App.Path & "\tmpDb.mdb"
    
      j.CompactDatabase jStr & oldDb, jStr & newDb
    
      If Trim(bakDb) <> "" Then
        If fso.FileExists(bakDb) Then fso.DeleteFile bakDb
        fso.MoveFile oldDb, bakDb
      Else
        fso.DeleteFile oldDb
      End If
      fso.MoveFile newDb, oldDb
    
      DbCompact = 0
    
    noDbOk:
    
      Set fso = Nothing
      Set j = Nothing
    
    End Sub 
    

    copy | embed

    0 comments - tagged in  posted by beccoblu on Jan 27, 2010 at 11:16 a.m. EST
Sign up to create your own snipts, or login.