Rabu, 15 September 2010

Compact and Repair MS Access

Bagi Anda yang sudah mengenal MS Access tentu tahu fasilitas "Compact and Repair". Kalau diartikan ke dalam Bhs. Indonesia, kata "Compact and Repair" berarti memadatkan dan memperbaiki. Berikut cara yang digunakan untuk mengakses fasilitas tersebut :

Tambahkan References "Microsoft Access XX.0 Object Library".

[ VB 6.0 ]
Dim acApp As New Access.Application
Dim LokFile As String

LokFile = "Gantikan dengan lokasi file MS Access"

Name LokFile As LokFile & ".tmp" 'create temp

acApp.CompactRepair LokFile & ".tmp", LokFile 'process

Kill LokFile & ".tmp" 'delete temp


[ VB .NET ]
Dim acApp As New Microsoft.Office.Interop.Access.Application
Dim LokFile As String

LokFile = "Gantikan dengan lokasi file MS Access"

Rename(LokFile, LokFile & ".tmp")

acApp.CompactRepair(LokFile & ".tmp", LokFile) 'process

Kill(LokFile & ".tmp") 'delete temp


CATATAN :
Untuk mencegah kesalahan yang mungkin terjadi, backup dulu file databasenya.
Sebelum melakukan proses Compact and Repair, pastikan tidak ada koneksi yang aktif ke file database. Dan juga tidak ada aplikasi lain yang mengakses file database tersebut.

Label: , , ,

0 Komentar:

Posting Komentar

Pengunjung yang baik selalu meninggalkan jejak berupa komentar. :)

Berlangganan Posting Komentar [Atom]

<< Beranda