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:
- 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
Else
rst.MoveFirst
rst.Move lngRow
to read:
Else
rst.MoveFirst
rst.Move lngRow - 1
- 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
- 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"
- Save and close the query.
- 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