Looping Property Let Causing Error

P

Paul

Hello,

I am encountering a situation where a Property Let in a Class Module is
looping between a private procedure in the same Class Module. The private
procedure is called from the private Property Let procedure. The private
procedure uses the FindFirst method, but the recordset has no records. I can
see the system continuously looping 100+ times when I view the Call Stack
window and then I get the Out of Stack Space error. I am using Access 2003
and DAO on Win XP. My code is:

Private Property Let AcctBalance(ByVal varNewAcctBalance As Variant)
' The p tag is to denote a Class property variable.

' Set an error handler.
On Error GoTo Err_AcctBalance

' Call the procedure to get the dollar amount.
AcctBalance = _
fMatchAcctDollarBalance(Nz(pAccountNumber, 0), pAcctDollarBalanceRec)

' Assign the value to the Class property.
pAcctBalance = IIf(IsNull(varNewAcctBalance) = True, 0, varNewAcctBalance)

' Exit point.
Exit_AcctBalance:
On Error Resume Next

Exit Property

' Error handler.
Err_AcctBalance:
MsgBox "An unexpected error occurred." & vbCrLf & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbExclamation +
vbOKOnly, _
gstrcAppTitle

' Go to the exit point.
Resume Exit_AcctBalance
End Property


Private Function fMatchAcctDollarBalance(ByVal strAcctNumber As String, _
ByVal rsDollarBalance As DAO.Recordset)

' Set an error handler.
On Error GoTo Err_fMatchAcctDollarBalance

' Assume none was found.
fMatchAcctDollarBalance = 0

' Access the recordset's properties.
With rsDollarBalance
' Check for a populated recordset.
' ******* The BOF and EOF evaluate properly to True *********
If Not (.BOF = True And .EOF = True) Then ' Has records.
.FindFirst "[ConcatFundAccount] = '" & strAcctNumber & "'"

' Check for a match.
If Not .NoMatch = True Then ' Found it.
' Return the dollar balance.
fMatchAcctDollarBalance = rsDollarBalance.Fields(1)
Else ' Not found.
' Reposition cursor to the beginning.
.MoveFirst
End If 'End checking for a match.
End If ' End checking for a populated recordset.
End With ' End accessing the recordset's properties.

' Exit Point.
Exit_fMatchAcctDollarBalance:
' Clean up and get out.
On Error Resume Next

Exit Function

' Error handler.
Err_fMatchAcctDollarBalance:
' Evaluate the error number.
Select Case Err.Number
Case 91 ' Recordset is Nothing.
' Do nothing.
Case Else ' Unexpected.
' Warn the user.
MsgBox "An unexpected error occurred." & vbCrLf & vbCrLf & _
"Error " & Err.Number & ": " & Err.Description, vbCritical, _
gstrcAppTitle
End Select

' Go to the exit point.
Resume Exit_fMatchAcctDollarBalance
End Function


Any help is appreciated. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top