unabomberto 0 Newbie Poster

Hi guys,
I'm trying to import an Excel Spreadsheet to Microsoft Access Database but this Error Message always show up
"NOT A VALID FILE NAME"

Can you please guys help me out. ^_^

Thanks a lot! :)

Try
            Dim acc As String = "C:\ffsclines.accdb"
            Dim exx As String = "C:\FFSC.xls"

            Dim conn As New OleDbConnection
            conn.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & exx & ";Extended Properties=Excel 8.0;")

            Dim cmd As New OleDbCommand
            cmd.Connection = conn
            cmd.CommandText = "Select * into [MS Access;Database= " & acc  & "].[New Table] from [Sheet1$]"

            conn.Open()
            cmd.ExecuteNonQuery()
            conn.Close()
            MessageBox.Show("IMPORT COMPLETE")

Catch ex As Exception
      MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.