Why this code crash Excel?
When I try to exit this program, the excel crashed.
Here is the code: Public Sub GetLastInfo(sql$, isPre As Boolean, ByRef averCoupon, ByRef HistCls As ClsPreLoss) Dim m_adRst As New ADODB.Recordset Set m_adRst = New ADODB.Recordset On Error GoTo ERROR_HANDLER If m_micADOConn Is Nothing Then ConnectMICDB m_adRst.Open sql, m_micADOConn, ADODB.adOpenForwardOnly, ADODB.adLockReadOnly Dim averCoupon2 As Double If isPre Then HistCls.Pre_Bal = m_adRst.Fields("cBal") HistCls.interest = m_adRst.Fields("nextInterest") averCoupon = m_adRst.Fields("AverCoupon") Else HistCls.cBal = m_adRst.Fields("cBal") HistCls.sBal = m_adRst.Fields("totalSched") averCoupon2 = m_adRst.Fields("AverCoupon") HistCls.averCoupon = (averCoupon + averCoupon2) / 2 End If m_adRst.Close Exit Sub ERROR_HANDLER: MsgBox "GetLastInfo failed: " & Err.Description End Sub |
All times are GMT +1. The time now is 03:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com