Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
this code makes excel crash zz Excel Programming 0 December 22nd 06 11:14 PM
Adding code to control on form causes Excel to crash skuzapo Excel Programming 3 September 22nd 05 09:14 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM
Problem with code causing Excel '97 to crash Pozzo[_6_] Excel Programming 0 June 16th 04 08:19 PM
Excel crash error code Ed[_17_] Excel Programming 1 February 16th 04 10:46 AM


All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"