Solved

compact and repair

Posted on 2003-11-12
3
583 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9732609
0
 
LVL 86

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

737 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