Skip to content
Advertisement

Issue with ODBC Object connection – Open limitation to 65k rows

New to programming, SQL and VBA. I frequently work with decent size data tables and thought it would be helpful to add SQL query execution capability to apply to an existing excel table. Research led me to ADODB connections and found a great base snippet to work from here: https://blog.learningtree.com/excel-as-a-database-how-to-query-economic-data-with-sql/

I seem to running into limits though on how many rows are accessible before the next line of code runs. In my SQL statement source I can return 65k rows, any more in defining the source table size, and I get an Object does not exist error. Can you run ADODB recordset.Open asynchronously to ensure complete return of the object? – Any help would be very much appreciated. Thanks!

tried to insert a WAIT inline: rs.Open strSQL, Application.Wait (Now + TimeValue("0:00:30")), cn but still errors out. See code below

These are the results I am getting:

  • Works: strSQL = "SELECT * FROM [Sheet1$A1:AI65000] WHERE GROUP = 'HIX'"

  • Error: strSQL = "SELECT * FROM [Sheet1$A1:AI65437] WHERE GROUP = 'HIX'"

Run-time error ‘-2147217865 (80040e37)’: The Microsoft Access database engine could not find the object ‘Sheet1$A1:AI65437’.

Advertisement

Answer

I think this is because you are calling old version library through this part of connection string:

You should try

Upd: Answer was here Excel as database – query more than 65536 rows? interesting. You cannot mention rows, or you’ll get error.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement