Solved

compact and repair

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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 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…

910 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

23 Experts available now in Live!

Get 1:1 Help Now