Solved

compact and repair

Posted on 2003-11-12
3
582 Views
Last Modified: 2012-05-04
im looking to compact and repair a database.  my databases exist in access 2002 and im using ado in vb.

what i dont understand is why i need an old database and a new database.  heres some code that i found on the net

Dim JRO As JRO.JetEngine
Set JRO = New JRO.JetEngine

JRO.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myData1.mdb", "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myDataNewName.mdb" & ";Jet OLEDB:Engine Type=5"

if someone could enlighten me on what this new database thing is, and how to get this working, id greatly appriciate it
0
Comment
Question by:bramsquad
3 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9732609
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 60 total points
ID: 9732664
It will take myData1.mdb, compact it, and place the results in myDataNewName.mdb.
myData1.mdb will remain unchanged.
You then have to delete myData1.mdb and rename myDataNewName.mdb to myData1.mdb.

When you do this from within Access, it does all the magic for you.  You just probably never realized what it was actually doing. =)

Idle_Mind
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 65 total points
ID: 9733380
like

JRO.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myData1.mdb", "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myDataNewName.mdb" & ";Jet OLEDB:Engine Type=5"
kill C:\myData1.mdb
name C:\myDataNewName.mdb as C:\myData1.mdb
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Put text in a picture ASP.NET C# 2 68
MsgBox 4 71
VB6 ListBox Question 4 56
VB6 - Scroll Mouse wheel on Picturebox 13 95
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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