[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

compact and repair

Posted on 2003-11-12
3
Medium Priority
?
586 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 240 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 260 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 October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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