10-08-2009, 03:32 PM
I need to Export an excel sheet to an access table. I get one new excel sheet every month. I could able to do this with the below script.
Option Explicit
But when i am executing this script i am getting an error in the last line "Record is too large". My excel sheet is containing around 255 columns and 2100 rows.
Can anyone tell me how to resolve this error and successfully import excel sheet to access table?
Any help is appreciated!
Thanks
Sheela
Option Explicit
Code:
Dim objADOXDatabase,objExcelConn,objAccessConn,objAccessRS,objExcelRS,strSQL
Set objADOXDatabase = CreateObject("ADOX.Catalog")
'Create the database file
objADOXDatabase.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=w:\customer.mdb"
Set objADOXDatabase=Nothing
Set objExcelConn = CreateObject("ADODB.Connection")
Set objAccessConn = CreateObject("ADODB.Connection")
objAccessConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=W:\customer.mdb"
'objExcelConn.Open objAccessConn
objExcelConn.Provider = "Microsoft.Jet.OLEDB.4.0"
objExcelConn.Properties("Extended Properties").Value = "Excel 8.0"
objExcelConn.Open "W:\test.xls"
set objAccessRS = Createobject("ADODB.Recordset")
Set objExcelRS = CreateObject("ADODB.Recordset")
strSQL = "SELECT * INTO [Scenario] FROM [Excel 8.0;DATABASE=W:\test.xls;HDR=No;IMEX=1].[sheet1$];"
objAccessConn.Execute strSQL
But when i am executing this script i am getting an error in the last line "Record is too large". My excel sheet is containing around 255 columns and 2100 rows.
Can anyone tell me how to resolve this error and successfully import excel sheet to access table?
Any help is appreciated!
Thanks
Sheela