|
-
May 29th, 2006, 12:13 AM
#1
Thread Starter
Addicted Member
compact a msaccess db
hi..
can you pls. give me a link on how to compact a msaccess database within vb6 project.
thanks,
alexis
-
May 29th, 2006, 05:13 AM
#2
Hyperactive Member
Re: compact a msaccess db
use:
VB Code:
DBEngine.CompactDatabase("xyz.mdb","abc.mdb")
I think u need to refere DAO in your project...
The Difference between a Successful person and others is not a Lack of Knowledge,
But rather a Lack of WILL 
-
May 29th, 2006, 05:35 AM
#3
Re: compact a msaccess db
Or else Use Microsoft JRO.
Add a reference to Microsoft Jet and Replication Objects 2.x Library by opening Project Menu. And then use this function
VB Code:
Public Function compactRepairMDB(ByVal sourceMDBPath As String, ByVal targetMDBPath As String) As Boolean
Dim jetReplicationObject As JRO.JetEngine
Set jetReplicationObject = New JRO.JetEngine
jetReplicationObject.CompactDatabase _
"Provider=Microsoft.Jet.OleDB.4.0;Data Source=" _
& sourceMDBPath, "Provider=Microsoft.Jet.OleDB.4.0;Data Source=" _
& targetMDBPath
compactRepairMDB = True
Set jetReplicationObject = Nothing
Exit Function
CompactErr:
compactRepairMDB = False
End Function
You can use this function like this
VB Code:
JetReplication.compactRepairMDB("C:\db1.mdb", "C:\db2.mdb")
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 29th, 2006, 07:34 PM
#4
Thread Starter
Addicted Member
Re: compact a msaccess db
what are the things i should consider?? should the database be closed first?? how would i know if someone is still using the database?? can i check if the ".ldb" exists, does it mean someone is still using the database?? is it reliable??
-
May 29th, 2006, 08:36 PM
#5
-
May 29th, 2006, 09:25 PM
#6
Thread Starter
Addicted Member
Re: compact a msaccess db
ok thanks, i 'll try the code above.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|