Results 1 to 5 of 5

Thread: CompactDatabase and ADO

  1. #1
    Guest
    Using VB6 and Access 2000

    When you want to compact a database and your using ADO,
    do you still use:-

    DBEngine.CompactDatabase "olddb", "newDB"

    In the VB docs it only ever references DAO when you
    look up CompactDatabase

    Is there another way?

    Thanks,

    SeanR

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    compact a database using ADO
    Code:
        'uses ADO 2.x and Microsoft Jet and Replication Objects 2.x
    
        'declare variables
        Dim objJRO As JRO.JetEngine
        Dim strConnSource As String
        Dim strConnDestination As String
        
        'set connection string info
        strConnSource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind2k.mdb"
        strConnDestination = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NewDb.mdb"
            
        'instantiate object
        Set objJRO = New JRO.JetEngine
        
        'compact database from source to destination
        objJRO.CompactDatabase strConnSource, strConnDestination
        
        'release objects
        Set objJRO = Nothing

  3. #3
    Guest

    Wink

    Thanks for your help ClientP

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    ClientP?

    Close enough....

  5. #5
    Guest

    Smile

    Sorry abount that ClunietP.

    It should teach me to look more closely and not
    just scan.

    SeanR


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