Change Timeout on ADODB Query

I have an Access 2000 database with a MS SQL 2005 back end. I'm running queries that are timming out as the database grows. We have a long term solution but I need something to get them up and running now.

How do I increase the timeout to run the query on the code below?
Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    SQL = "Select * from MyTable"
    rs.Open SQL, CurrentProject.Connection

Open in new window

LVL 10
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CurrentProject.Connection.Timeout = 0
Dear slamhound,

Just sharing what I usually do when getting performance issue in my access application:
1. compact & repair database then test the performance
go to menu: Tools  - Database utilities

2. If it still doesn't work, then you can change the commandtimeout property in connection object. commandtimeout is in seconds.

this is what the code should like :

Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    SQL = "Select * from MyTable"
    'in 10 minutes, default is 30
    rs.Open SQL, CurrentProject.Connection

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thiyagukTech Lead Commented:
1.Try to Rebuild all Indexes
2.Try to reduce the amount of data from the select query (Use where clause in sql queries)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.