PRB: InSelection Property Example Returns Incorrect ValueArticle ID: Q138773Creation Date: 26-OCT-1995 Revision Date: 19-SEP-1996
The information in this article applies to:
SYMPTOMS
Moderate: Requires basic macro, coding, and interoperability skills
The sample function, IsControlSelected() in the InSelection Property
Example in online Help returns 0 (False) even if the control you are
looking for is selected.
CAUSE
The For...Next loop in the IsControlSelected() function continues to run
even after the desired control is found. The IsControlSelected() function
actually returns the last control checked on the form. This code would only
return -1 (True) if the control searched for is the last one on the form.
RESOLUTION
In the IsControlSelected() function, right after the line
IsControlSelected = Trueadd the following line:
Exit FunctionREFERENCES For more information about InSelection, search for "InSelection," and then "InSelection Property" using the Microsoft Access for Windows 95 Help Index. For more information about For...Next loops, search for "For Statement," and then "For...Next Statement" using the Microsoft Access for Windows 95 Help Index. |
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.