Microsoft KB Archive/151553

{|
 * width="100%"|

PRB: AddAllToList Function in Solutions.mdb Replaces First Row
'Article ID: Q151553

Creation Date: 25-MAY-1996

Revision Date: 23-JAN-1997' The information in this article applies to:


 * Microsoft Access version 7.0

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

The function AddAllToList overwrites the first row of a combo box or list box. AddAllToList should add the word "(All)" above the first row. The function AddAllToList is available in the sample database Solutions.mdb.

NOTE: Knowledge Base article Q138976 has the same resolution as this article, but the symptom and cause are different.

CAUSE

The sample function does not adjust its record count for the "All" entry that is added to the list.

RESOLUTION

 Open the sample database Solutions.mdb 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.

MORE INFORMATION

Steps to Reproduce Behavior

 Open the AddAllToList form in the sample database Solutions.mdb.</li> Click the arrow next to the Select Customer combo box to see the list and note that the first company displayed is "Ana Trujillo Emparedados y helados."</li>  Change the RowSourceType property of the combo box from AddAllToList to Table/Query, view the form, and then view the list. Note that "Alfreds Futterkiste" is now the first available customer in the list. When the AddAllToList function is implemented, the first row, "Alfreds Futterkiste," is replaced by "(All)." </li></ol>
 * }

-

"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." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

KBCategory: kbusage

KBSubcategory: DcmSltn

Additional reference words: 7.00