Excel export to Access
Here is the code.
Please add a reference to Microsoft ActiveX Data Object
Dim con as new ADODB.Connection
Dim strcon as String
Dim strSQL as String
strcon = "Provider=Microsoft.Jet.OLEDB.4.0;"
strcon = strcon & "Data Source=C:\MWCI\Database\Dbase.mdb;"
strcon = strcon & Persist Security Info=False"
con.Open strcon
strSQL = "INSERT INTO TABLE1 "
strSQL = strSQL & "SELECT * FROM [Excel
8.0;Database=C:\book1.xls].[Sheet1$]"
con.Execute strSQL
set con = nothing
replace Table1 with the name of your table
in MsAccess same with the
Database=C:\book1.xls
Data Source=C:\MWCI\Database\Dbase.mdb
Sheet1
Hope this will help u.
Arthur
|