Subscript out of range (1 Viewer)

carlboone

New member
Local time
Today, 17:09
Joined
Oct 7, 2008
Messages
6
I am getting a "subscript out of range" message when attempting to import an Excel spreadsheet into a NEW table.

I have seen a couple other references to this problem, but the recommendation seems to be "redefine the table columns". However, in this case I'm letting Access create the table. The error occurs when I click Next after selecting the tab I want to import.

The previous version of the spreadsheet has exactly the same format (and can still be imported successfully). I did, however, delete a substantial number of rows from the new version.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:09
Joined
Feb 28, 2001
Messages
27,175
The problem might be that the wizard doing the import has a limit on the number of fields it can import. I believe no record can contain more than 255 fields. Is there a chance that you have this many?
 

carlboone

New member
Local time
Today, 17:09
Joined
Oct 7, 2008
Messages
6
That seems to have been the problems. When I used <Ctrl>-<End> to go to the "end" of the worksheet, it went to column AK. There is no data in that column that I can see.

After copying the data into a new worksheet, I was able to import the data into a new table successfully.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 22:09
Joined
Sep 12, 2006
Messages
15,653
i find this with importing excel - if there has EVER been data (I assume) in an excel row/column it (tries to) import the blank data - which can cause issues if you are loading it into an existing table, with insufficient columns

where its important i tend to do the following

a) the access table i want to use
b) import the spreasheet into a new table
c) verify that all the field names in the access table are present in the spreadsheet import (using tabledefs object), which guards against some idiot modifying the spreadsheet
d) tidy my spreadsheet by deleting blank rows/validating any stuff i need
e) its a matter of taste whether you
1 - import spreadsheet without column heads, which assumes a mandatory order or
2 - import spreadsheet with column heads, which then causes issues with missing columns
you cant do both, i think

and only then
f) append the spreadsheet table to the access table
 
Last edited:

Users who are viewing this thread

Top Bottom