Private withevents M_Conn as adodb.connection

Private CmdFinished as boolean
sub somesub
    AdoCmd.Execute , , adAsyncExecute
    do while not CmdFinished 
        doevents
    loop
end sub

'Change the CmdFinished value on the connection_ExecuteComplete event and connection_WillExecute
Private Sub M_Conn_ExecuteComplete(ByVal RecordsAffected As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection)
    CmdFinished = True
End Sub

Private Sub M_Conn_WillExecute(Source As String, CursorType As ADODB.CursorTypeEnum, LockType As ADODB.LockTypeEnum, Options As Long, adStatus As ADODB.EventStatusEnum,ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection)
    CmdFinished = False
End Sub

 

相关文章:

  • 2021-10-31
  • 2021-10-06
  • 2021-10-21
  • 2021-08-22
  • 2022-12-23
猜你喜欢
  • 2021-08-01
  • 2022-12-23
  • 2021-08-10
  • 2021-09-11
  • 2021-11-02
  • 2021-06-15
相关资源
相似解决方案