<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:jp@ledure.be" title="Jean-Pierre Ledure <jp@ledure.be>"> <span class="fn">Jean-Pierre Ledure</span></a>
</span> changed
<a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - Access2Base Counter for OpenRecordset usage is too low"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=121342">bug 121342</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Ever confirmed</td>
<td>
</td>
<td>1
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>UNCONFIRMED
</td>
<td>ASSIGNED
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - Access2Base Counter for OpenRecordset usage is too low"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=121342#c9">Comment # 9</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - Access2Base Counter for OpenRecordset usage is too low"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=121342">bug 121342</a>
from <span class="vcard"><a class="email" href="mailto:jp@ledure.be" title="Jean-Pierre Ledure <jp@ledure.be>"> <span class="fn">Jean-Pierre Ledure</span></a>
</span></b>
<pre>Hi,
I reproduced the issue with a variant of the script in <a href="show_bug.cgi?id=121342#c7">Comment 7</a>:
Sub TestBug121342()
Dim db As Object, rec As Object, k As Long
Set db = Application.CurrentDb()
db.CloseAllRecordsets()
k = 0
Do
k = k + 1
If k Mod 100 = 0 Then DoCmd.SysCmd(acSysCmdSetStatus, "k = " &
k)
Set rec = db.OpenRecordset("FACTURE")
rec.mClose
Loop
db.CloseAllRecordsets()
End Sub
Indeed the overflow is caused by the RecordsetMax variable which is an Integer
and is,as a consequence, limited to 32767. Additionally the variable is not
decremented when a recordset is closed, as should => This is a bug.
Replacing in the Database module of the Access2Base library the definition of
RecordsetMax by replacing Integer by Long
- is a workaround for the current issue,
- has NO ADDITIONAL SIDE EFFECTS.
I suggest you to bypass the issue in your own code by adding something like
If k Mod 100 = 0 Then db.RecordsetMax = 1
in the above loop. (1 and not 0 to force CloseAllRecordsets to do something
even if the number of open recordsets in the same run is a multiple of 100
...).
I will prepare a patch on master to make RecordsetMax a Long type and to
include somewhere a decrement of its value.
JPL</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>