¤ I need to read an excel file, and add that data into msaccess database.
¤ Can anyone help me?
¤
Try the following:
Public Sub ImportExcelToAccess()
Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")
AccessConn.Open()
'New table
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [tblSheet1] FROM
[Excel 8.0;DATABASE=e:\My Documents\Book10.xls;HDR=NO;IMEX=1].[Sheet1$]", AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
End Sub
Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)