Microsoft KB Archive/129466

From BetaArchive Wiki

PRA: List Box RowSource Runs Twice When Set at Run Time

Article ID: Q129466
Creation Date: 26-APR-1995
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 table or query specified in the RowSource property of a list box run twice.

CAUSE


The problem described above occurs if you use Access Basic code to set the list box's RowSource property at run time.

STATUS


Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access for Windows 95 version 7.0.

MORE INFORMATION


Steps to Reproduce Problem


  1. Open the sample database NWIND.MDB.
  2. Create a new form that is not based on any table or query.
  3. Add a list box to the form and set the following properties for the list box.

    NOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code.

          Name: Field0
          RowSource: SELECT [Employee ID] FROM Employees WHERE [Employee ID]>_
          [What Employee?]
  4. Add a command button to the form and enter the following code for the command button's OnClick event procedure:

          Me![Field0].RowSource = Me![Field0].RowSource
  5. View the form in Form view. Note that the Parameter dialog box appears as you expect.
  6. Type the number "4" (without the quotation marks), and then choose the OK button.
  7. Choose the command button. Note that the Parameter dialog box appears as you expect.
  8. Type the number "4" (without the quotation marks), and then choose OK. Note that the Parameter dialog box appears a second time.



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
KBSubcategory: FmsCmbo