ACC95: "No current record" Using AddAllToList() Function

Last reviewed: May 27, 1997
Article ID: Q138976
The information in this article applies to:
  • Microsoft Access version 7.0

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:

  1. Open the Solutions.mdb database without running its AutoExec macro. To do so, press SHIFT while you open the database.

  2. Open the AddAllToListModule module.

  3. In the Procedure list box on the toolbar, select AddAllToList.

  4. 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
    
    

  5. Modify the section of code that reads

                Else
                   rst.MoveFirst
                   rst.Move lngRow
    
       to read:
    
                Else
                   rst.MoveFirst
                   rst.Move lngRow - 1
    
    

  6. Save the module and close the database.

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.

MORE INFORMATION

Steps to Reproduce Problem

  1. 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:

          "Return No Records"
    

  2. Save and close the query.

  3. Open the AddAllToList form. Note that you receive the error message:

          No current record.
     
    
    
    	
    	


Keywords : DcmSltn kberrmsg kbusage
Version : 7.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.