Question : ODBC timeout issue with access connecting to an SQL database

I have a table in access 2003 which is linked to an SQL datasource.  I have a need to update 7000+ records in a bulk update process.  My form gathers a list of primary keys then applies the selected update to all of the records whose primary key appears in the list.  I wrote something very similar to:

UPDATE Table SET Field = 'VALUE' WHERE KeyIndex IN ('1','2','3')

etc..using the DoCmd. I dynamically build this SQL statement based on some selections on the form.  Using the above query.  I start to have performance issues around 3k records or so and I get an ODBC timeout error.  So I started using a loop and updating the records individually as follows:

For x = 0 to Ubound(KeyIndexArray)

     DoCmd UPDATE Table SET Field = 'VALUE' Where KeyIndex = " & KeyIndexArray(x)
     DoEvents

Next x

With the above code I get to about 4.5k records and get an ODBC error.. never on the same record.. and I tested the query in SQL itself and it works fine with the values that are to be presented each time.  Any suggestions.. is there a transaction limit on an ODBC connection?  Also, the MS Access DB is only being used as a front end, there are no local tables in it.. it sits on a HUGE web class server with an abundance of RAM and processing power and I am the only one who has access to the box so I know it's not a load issue.  Any suggestions are greatly appreciated.. and certainly welcome.

Answer : ODBC timeout issue with access connecting to an SQL database

Why don't you do a "Pass Through Query"???
Open Queries in Access , Select SQL Spesific--> Pass Through Query (PTQ)

PTQ are executed directly on the datasource , in your case directly on the SQL server, they use ODBC (properties of the query) and you can access them by code

I think that this will solve your problems
Random Solutions  
 
programming4us programming4us