Results 1 to 4 of 4

Thread: compressing DBF data files....

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    DFW, Texas
    Posts
    12

    Lightbulb

    I am working on a VB6 project using the DAO control to a .DBF file. I am trying to find a way to 'Compress' the data file after have run a SQL command to clear the Table. such as

    sSQL = "delete * from pay"
    DB.Execute (sSQL)

    I do not wish to destroy the original table since I want to review the data after the program has stopped processing. <This is for debug purposes>

    Any and all ideas are welcome.

  2. #2
    Junior Member Cadejos's Avatar
    Join Date
    Dec 2000
    Location
    Costa Rica
    Posts
    29

    Talking 'Compress'

    Check out the CompactDatabase Method in the Visual Basic Help, a friend use it for compressing a Access file and it works very nice. Hope it help you out.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    DFW, Texas
    Posts
    12
    Thanks I'll give it a try..

  4. #4
    Junior Member Cadejos's Avatar
    Join Date
    Dec 2000
    Location
    Costa Rica
    Posts
    29

    Talking Found an example...

    > > **********************************************************
    > > 'Passing values compactDB module
    > > 'Sour_path = Source path of existing database.
    > > 'Dest_Path = Target path
    > > '
    > > 'Note -
    > > 'Add Microsoft Jet and Replication Objects X.X library,
    > > 'where (X.X is greater than or equal to 2.1).
    > > '***********************************************************
    > > 'Jet OLEDB:Engine Type Jet x.x Format MDB Files
    > > '********************* ************************
    > > ' 1 JET10
    > > ' 2 JET11
    > > ' 3 JET2X
    > > ' 4 JET3X
    > > ' 5 JET4X
    > > '**********************************************************
    > >
    > > Option Explicit
    > >
    > > Public Function compactDB(ByVal SOUR_path As String, _
    > > ByVal DEST_path As String) As Boolean
    > >
    > > On Error GoTo Err_compact
    > > Private JRO As New JRO.JetEngine
    > >
    > > ' Source and Destination connection path
    > > Private DB_sour As String, DB_dest As String
    > >
    > > DoEvents
    > > DB_sour = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
    > > & SOUR_path
    > > DB_dest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
    > > & DEST_path & " ;Jet OLEDB:Engine Type=5"
    > >
    > > JRO.CompactDatabase DB_sour, DB_dest
    > >
    > > compactDB = True
    > > Exit Function
    > >
    > > Err_compact:
    > > compactDB = False
    > > MsgBox Err.Description, vbExclamation
    > > End Function
    > >
    > > '*************************************************
    > > ' Usage Module level or form level.
    > > '*************************************************
    > >
    > > ' Dim source_path,Target_path as string
    > >
    > > ' source_path=App.Path & "\Nwind.MDB"
    > > ' Target_path=App.Path & "\CompactNwind.MDB"
    > >
    > > ' If not compactDB(source_path,Target_path) Then
    > > ' MsgBox "An error occurred while attempt to rename database " _
    > > ' & vbCrLf & vbCrLf & DBCP_Name, vbExclamation
    > > ' End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width