Recursive ADODB recordset.AddNew's shaky

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

[i might just needed to re-boot; reckon that's it, ignore the following pre-did inquiry Good People]

I've invented my first big VBA function, but when I send my stuff down to it it'll fail to write 1 out of 24 records, or hang. Plus it takes a long time.

So, I am wondering about some tests; the rst is at EOF, or it doesn't matter, right?

Roughly,
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Set rst1 = New ADODB.Recordset
rst1.ActiveConnection = "
rst1.Open "tbl", , adOpenKeyset, adLockOptimistic, adCmdTable

(same for rst2)

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
Select Case ctl.Name
Case "txtJeffCo_1DUIfine"
blnResult = HandleTransaction(curMoney, 1, Nz(ctl.Value, "?"), True, rst1, rst2)
Case
 
Jim Shores said:
[i might just needed to re-boot; reckon that's it, ignore the
following pre-did inquiry Good People]

I've invented my first big VBA function, but when I send my stuff
down to it it'll fail to write 1 out of 24 records, or hang. Plus it
takes a long time.

So, I am wondering about some tests; the rst is at EOF, or it doesn't
matter, right?

Roughly,
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Set rst1 = New ADODB.Recordset
rst1.ActiveConnection = "
rst1.Open "tbl", , adOpenKeyset, adLockOptimistic, adCmdTable

(same for rst2)

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
Select Case ctl.Name
Case "txtJeffCo_1DUIfine"
blnResult = HandleTransaction(curMoney, 1,
Nz(ctl.Value, "?"), True, rst1, rst2) Case
.
.
Case
End Select
End If
Next

'>>>>>>>>>the .AddNews & .Updates in there>>>>>>>>>>>>>>
'Public Function HandleTransaction(ByVal curMoney As Currency,
intPayTo As Integer, _
'strMOnumber As String, _
'ByVal blnStamp As
Boolean, rstMain As ADODB.Recordset, _ 'rstDetail As ADODB.Recordset)
As Boolean '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I can't make any sense out of your post. Would you care to elaborate?
Certainly if you want suggestions on the code in your routine, you'll
have to post the code. I don't see anything recursive in what you
posted.
 
Yes Sir, Mr. Goldar,
I used the word recursive because, time after time, (on account of the For Next loop through the edit controls), there are multiple occasions when my little Function is called to perform some simple record-writes. There may be some more localized usage of that word and I am just not aware of it.
 
Jim Shores said:
Yes Sir, Mr. Goldar,
I used the word recursive because, time after time, (on account of
the For Next loop through the edit controls), there are multiple
occasions when my little Function is called to perform some simple
record-writes. There may be some more localized usage of that word
and I am just not aware of it.

It's not my intention to quibble over technicalities, but sometimes they
make a difference. "Recursive" refers to a procedure that, directly or
indirectly, calls itself. For example, the definition of the
"Factorial" function -- given number N, return N! (N factorial) -- might
be defined recursively, like this:

Function Factorial(N As Long) As Double

'*** EXAMPLE ONLY -- not a proper implementation ---

If N <= 1 Then
Factorial = N
Else
Factorial = N * Factorial(N - 1)
End If

End Function

Or the famous dictionary definition of "recursive"

Recursive - adj.; see Recursive.

What you describe, calling the function over and over again in a loop,
is more properly called "iterative". It makes a difference in
debugging, because sometimes recursive routines fail to handle the
housekeeping properly and "blow out".
 
Back
Top