[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

CompactDatabase Jet 4.0

Posted on 1999-11-23
4
Medium Priority
?
342 Views
Last Modified: 2013-12-25
I keep getting unrecognized database format when I try to compact a Jet 4.0 database within  a VB programme.
How do I get it to work?
0
Comment
Question by:gregbinns
4 Comments
 
LVL 1

Expert Comment

by:leesss
ID: 2232517
Can you open a Jet 4.0 db first?
0
 

Author Comment

by:gregbinns
ID: 2233347
Yes I can open recordsets etc. no trouble.
0
 
LVL 3

Expert Comment

by:jetforce
ID: 2234121
What DAO library are you using? Is it 3.6 or 3.5?
0
 
LVL 7

Accepted Solution

by:
Dedushka earned 200 total points
ID: 2234811
Hi gregbinns.
You can compact Jet 4.0 databases using CompactDatabase Method of JetEngine object from Jet and Replication Objects (JRO).
Here is code taken directly from MSJRO.CHM help file:

CompactDatabase Method Example
This example demonstrates how to compact and encrypt a database with the CompactDatabase method.

Public Sub CompactAndEncrypt()

    Dim je As New JRO.JetEngine

    ' Make sure that a file doesn't exist with the name of
    ' the compacted database.
    If Dir("C:\Program Files\Microsoft Office\" & _
        "Office\Samples\Northwind2.mdb") <> "" Then Kill _
        "C:\Program Files\Microsoft Office\Office\Samples\Northwind2.mdb"

    ' Compacts and encrypts version Northwind database.
    je.CompactDatabase _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\Program Files\Microsoft Office\" & _
        "Office\Samples\Northwind.mdb", _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\Program Files\Microsoft Office\" & _
        "Office\Samples\Northwind2.mdb;" & _
    "Jet OLEDB:Encrypt Database=True"

End Sub

Best regards,
Dedushka
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question