I want to create a program which transfers all data from a selected Excel Spreadsheet (selected ussing the CommonDialog Control) to an Access DB (also selected using a CommonDialog Control). Here is the code I have for my "Convert" button:
Code:
Private Sub ConvertButton_Click()
Dim CnXL As New ADODB.Connection
CnXL.Provider = "Microsoft.Jet.OLEDB.4.0"
CnXL.ConnectionString = "Data Source = '" & ExcelText.Text & "'; Extended Properties = Excel 8.0"
CnXL.Open
CnXL.Execute "SELECT * INTO [CONVERSIONS] IN '" & AccessText.Text & "' FROM [Sheet1$]"
CnXL.Close
End Sub
[\code]
ExcelText and AccessText are textboxes containing the paths to the Excel Spreadsheet and Access Database respectively. An error arises at the Execute statement which gives a runtime error saying:
Run-time Error '-2147467259 (80004005)':
" is not a name. Make sure that it does not include invalid characters or punctuation and that it is not too long.
I am not really sure if ["] is one double quote (") or 2 single quotes (''). Could this be because the spreadsheet contains null values?? Any responses would be greatly appreciated.
Thanks
-vza