Agradezco la ayuda que me puedan brindar.
Atentamente,
Diego Pinzón
Note Use JRO, not ADO, to compact a database.
DAO
Sub DAOCompactDatabase()
' Make sure there isn't already a file with the
' name of the compacted database.
If Dir(".\NewNorthWind.mdb") <> "" Then Kill ".\NewNorthWind.mdb"
' Basic compact - creating new database named newnwind
DBEngine.CompactDatabase ".\NorthWind.mdb", ".\NewNorthWind.mdb"
' Delete the original database
Kill ".\NorthWind.mdb"
' Rename the file back to the original name
Name ".\NewNorthWind.mdb" As ".\NorthWind.mdb"
End Sub
JRO
Sub JROCompactDatabase()
Dim je As New JRO.JetEngine
' Make sure there isn't already a file with the
' name of the compacted database.
If Dir(".\NewNorthWind.mdb") <> "" Then Kill ".\NewNorthWind.mdb"
' Compact the database
je.CompactDatabase "Data Source=.\NorthWind.mdb;", _
"Data Source=.\NewNorthWind.mdb;"
' Delete the original database
Kill ".\NorthWind.mdb"
' Rename the file back to the original name
Name ".\NewNorthWind.mdb" As ".\NorthWind.mdb"
End Sub
The JRO CompactDatabase method takes two connection strings, which indicate
the source database and destination database respectively. See the JRO
online Help for more information on the JRO CompactDatabase method.
In addition to defragmenting or repairing your database, CompactDatabase can
also be used to change the database password, convert the database from an
older Microsoft Jet version to a new version, to encrypt or decrypt the
database, or to change the locale of the database. Note that CompactDatabase
will automatically convert older databases to the current version, unless
you use the Jet OLEDB:Engine Type property in the destination database
parameter.
--
Saludos ... Morgan 8-)
DGPPTB ...Cancún, Quintana Roo, México
PD. Que mueran las "k's", No respondo a quien abuse del uso de esta al
escribir