Sunday, March 11, 2012

Connection.close returns a 91 error code...

I have the next code in my proyect:

If CurrentProject.IsConnected Then
MsgBox "Base ya Conectada.Procedemos a cerrarla primero", vbOKOnly
If SQLConexion.State = adStateOpen Then SQLConexion.Close
SQLConexion.Close
End If
SQLConexion.Open SQLSentencia
AbreConexionSQLSERVER = 0

If I detect that the connection is opened while I am initializazing varriables, I want to close always the connection and then begins my aplicattion always opening the connection, but it always returns a error 91..

suggestions?

hi,

the message text instead of the error code would better help, but your code actually closes the conntection 2 times in the IF block, and this usually results in an axception to be raised..

regards

No comments:

Post a Comment