Microsoft KB Archive/138976

= ACC95: "No current record" Using AddAllToList Function =

Article ID: 138976

Article Last Modified on 11/17/2000

-

APPLIES TO


 * Microsoft Access 95 Standard Edition

-



This article was previously published under Q138976





SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.

When you use the AddAllToList function provided in the sample database Solutions.mdb to add (All) items to a combo box or list box list, you may receive the following error message:

No current record.



CAUSE
The combo box or list box RowSource property is set to a table, a query, or an SQL statement that returns no records.



RESOLUTION
To work around this problem, follow these steps:

 Open the Solutions.mdb database without running its AutoExec macro. To do so, press SHIFT while you open the database. Open the AddAllToListModule module. In the Procedure list box on the toolbar, select AddAllToList.  Modify the section of code that reads

     Case acLBGetRowCount ' Return number of rows in recordset. rst.MoveLast AddAllToList = rst.RecordCount

to read:

     Case acLBGetRowCount ' Return number of rows in recordset. On Error Resume Next rst.MoveLast AddAllToList = rst.RecordCount + 1   Modify the section of code that reads

<pre class="fixed_text">           Else rst.MoveFirst rst.Move lngRow

to read:

<pre class="fixed_text">           Else rst.MoveFirst rst.Move lngRow - 1 </li> Save the module and close the database.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed this to be a problem in Microsoft Access version 7.0. This problem no longer occurs in the AddAllToList code provided in the Solutions database that comes with Microsoft Access 97.

<div class="moreinformation_section">

Steps to Reproduce Problem
<ol>  Open the CustomerList query in the Solutions.mdb database in Design view and add the following criteria to the CustomerID field in the query grid:

<pre class="fixed_text">     "Return No Records" </li> Save and close the query.</li> Open the AddAllToList form. Note that you receive the error message:

No current record.</li></ol>

Keywords: kberrmsg kbbug kbfix kbusage KB138976

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.