ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check if ADO connection open (https://www.excelbanter.com/excel-programming/394550-check-if-ado-connection-open.html)

Clayman

Check if ADO connection open
 
Is there a way to check if an ADO connection is open in VBA? I'm currently
using:

If VacConn.Open Then VacConn.Close

assuming, wrongly of course, that the ADODB Connection Open method would
return a boolean...
--
Adios,
Clay Harryman

Vergel Adriano

Check if ADO connection open
 
Clay,

Try:

If VacConn.State = adStateOpen Then VacConn.Close


--
Hope that helps.

Vergel Adriano


"Clayman" wrote:

Is there a way to check if an ADO connection is open in VBA? I'm currently
using:

If VacConn.Open Then VacConn.Close

assuming, wrongly of course, that the ADODB Connection Open method would
return a boolean...
--
Adios,
Clay Harryman


Clayman

Check if ADO connection open
 
Thank you! That did the trick.
--
Adios,
Clay Harryman


"Vergel Adriano" wrote:

Clay,

Try:

If VacConn.State = adStateOpen Then VacConn.Close


--
Hope that helps.

Vergel Adriano


"Clayman" wrote:

Is there a way to check if an ADO connection is open in VBA? I'm currently
using:

If VacConn.Open Then VacConn.Close

assuming, wrongly of course, that the ADODB Connection Open method would
return a boolean...
--
Adios,
Clay Harryman



All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com