Solved

compact and repair

Posted on 2003-11-12
3
575 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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.
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now