5 pts.
 Compact Database in VB6
I would like to compact a database in VB6. Can someone please give me step by step directions. Thank you

Software/Hardware used:
ASKED: June 13, 2005  1:38 PM
UPDATED: June 14, 2005  7:57 AM

Answer Wiki:
What kind of database is it?
Last Wiki Answer Submitted:  June 13, 2005  2:48 pm  by  Mcp111   0 pts.
All Answer Wiki Contributors:  Mcp111   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I have done this. sDBPath and sDBNameBak come from a table earlier

Public Sub JROCompactDatabase()
Dim je As New JRO.JetEngine
Dim dbName As String
Dim dbBakName As String
On Error GoTo ERRH

dbName = sDBPath & sDBName
dbBakName = sDBPath & sDBNameBak
If Dir(dbBakName) “” Then Kill dbBakName
Name dbName As dbBakName
je.CompactDatabase “Data Source=” & dbBakName & “;Jet OLEDB:Engine Type=4;”, “Data Source =” & dbName & “;Jet OLEDB:Engine Type=4;”

Cleanup:
Set je = Nothing
Exit Sub
ERRH:
If Err.Number

 1,740 pts.

 

HI there,

I have developed a quick and easy app for tracking Computer Equipment within my organization.

Here is some quick code that will:
1. Create a new Compacted Database
2. Delete the old Backup
3. Create a new Backup from the original database

If mCompactDatabase = 1 Then
cmdCancel.Enabled = False
Command1.Caption = “&Please Wait …”
DBEngine.CompactDatabase “C:INVENTDATAINVENT.MDB”, “C:INVENTDATAINVNEW.MDB”, “”, dbEncrypt
Kill “C:INVENTDATAINVENT.BAK”
Name “C:INVENTDATAINVENT.MDB” As “C:INVENTDATAINVENT.BAK”
Name “C:INVENTDATAINVNEW.MDB” As “C:INVENTDATAINVENT.MDB”
Command1.Caption = “Process &Complete”
End IF

Hope you can follow the logic (it is pretty simple) and I sure hope this helps.

Thank you and have a great day.

Do not hesitate to contact me if you have any questions on this.

Gary R. Primrose
gprimrose@bearskinairlines.com

 0 pts.