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

ID: Q138976


The information in this article applies to:


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          : kberrmsg kbusage DcmSltn 
Version           : 7.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 28, 1999