Microsoft KB Archive/117165

From BetaArchive Wiki

PRB: AddAllToCompanyList() Function in SOLUTION.MDB Incorrect

Article ID: Q117165
Creation Date: 22-JUN-1994
Revision Date: 19-SEP-1996 The information in this article applies to:

  • Microsoft Access version 2.0

SYMPTOMS


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

The AddAlltoCompanyList() function in the SOLUTION.MDB sample database is used to fill a combo box with all the customers from the Customers table and the word "all" as an additional item in the list. This function is called by the Add All To List form. However, the list returned by the AddAlltoCompanyList() function is missing its last record.

CAUSE


The sample function does not adjust its record count for the "all" entry that is added to the list. Because of this, the last record from the table is omitted.

RESOLUTION


  1. Open the SOLUTION.MDB database without running its Autoexec macro by pressing SHIFT while you open the database.
  2. Open the Add All To List module.
  3. In the Procedure list box on the toolbar, select the AddAlltoCompanyList() function.
  4. Modify the section of code that reads

          Case LB_GETROWCOUNT
                      MyRecordset.MoveLast
                      AddAllToCompanyList = MyRecordset.RecordCount

    to read:

          Case LB_GETROWCOUNT
                      MyRecordset.MoveLast
                      AddAllToCompanyList = MyRecordset.RecordCount + 1
  5. Save the module and close the database.

STATUS This behavior no longer occurs in Microsoft Access for Windows 95 version 7.0.

REFERENCES


You can find information, instructions, and examples in the Solutions sample application (SOLUTION.MDB) included with Microsoft Access version 2.0. Open the SOLUTION.MDB database usually located in the ACCESS\SAMPAPPS directory. In the Select A Category Of Examples box, select Sample Forms, and then in the Select An Example box, select Add All To List.



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.


Additional reference words: 2.00
KBCategory: kbusage kbdocerr
KBSubcategory: FmsCmbo