Contoh konversi dari Excel ke Table Access

Dengan menggunakan Program Visual Basic 6 untuk mencoba konversi dari Excel ke Access. Contoh nya sebagai berikut :

Option Explicit

Private Sub Command1_Click() ‘Proses
On Error GoTo errHandler
Dim mExcelFile As String
Dim mAccessFile As String
Dim mWorkSheet As String
Dim mTableName As String
Dim mDataBase As Database
mExcelFile = App.Path & “\Book1.xls”
mAccessFile = App.Path & “\Db1.mdb”
mWorkSheet = “Sheet1”
mTableName = “Table1”

Set mDataBase = OpenDatabase(mExcelFile, True, False, “Excel 5.0”)
mDataBase.Execute “Select * into [;database=” & mAccessFile & “].” & mTableName & _
” FROM [” & mWorkSheet & “$]”
MsgBox “Selesai. Gunakan Program Access untuk melihat table ” & mTableName
Exit Sub
errHandler:
If Err.Number = 3010 Then
MsgBox mTableName & ” Sudah Ada.” & vbCrLf & _
“Hapus ” & mTableName & ” Gunakan tabel lain.”
Else
MsgBox Err.Number & ” ” & Err.Description
End If
End Sub

Satu Tanggapan

  1. sy tertarik dal lagi butuh program konversi excel ke acces. kalau boleh tplong kirim conoth program yang sudah jadi ke email saya wal38@rocketmail.com . terima kasih atas bantuannya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: