Discussion Locked

Access 97-Set ODBC Timeout in Code

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm using Access 97 as a front end to a SQL database. I've created a user friendly query builder form for users to look at data both detailed records and as a grouping query. In general it has been working extremely well.

Recently I've run intoa situation when I received an ODBC failed message. It turns out that the pass through query that was created took longer to execute than the default of 60 seconds, so it failed.

What is the VBA code to change the ODBC timeout setting? Does it automatically affect all pass-through queries created in VBA code or is it part of the values for a specified queries?

3 replies

by rrv

Yes you can change the default connection timeout or command timeout from 15 or 30 seconds to your wish. This has to be done while you are connecting using a connection object. for example
DBcon.CommandTimeout=120
DBcon.connectionTimeout=120

RV

by bob sellman

Thanks for pointing me in the right direction. I needed this to be able to change the timeout when I define a pass-through query in VBA code. (I do it as part of a query builder form I wrote.) It turns out that the query definition variable (I used qdf) has a property "ODBC Timeout". I should have thought of looking for the property, but didn't until your answer made me think along those lines. Thanks again.

This discussion is closed to new replies.