Microsoft KB Archive/147153

{|
 * width="100%"|

INF: "There Is No Current Code Context Object" Error Message
'Article ID: Q147153

Creation Date: 20-FEB-1996

Revision Date: 20-SEP-1996' The information in this article applies to:


 * Microsoft Access version 7.0

SYMPTOMS

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

The CodeContextObject property can only be used to refer to the current Form or Report object. Functions using the CodeContextObject property can only be called from the Form or Report object. If the function is called from the Debug window, you may receive the following error message:

There is no current code context object. STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  Create a new module and type the following code: Function ErrorMessage Dim objCurrent As Object Set objCurrent=CodeContextObject ErrorMessage=objCurrent.Name MsgBox ErrorMessage End Function  Create a new form and save it as TestContext. Add a command button to the TestContext form.  Set the command button's OnClick property as follows: "=ErrorMessage" View the TestContext form in Form view. Click the command button. Note that you receive a message with the name of the form. Press CTRL+G to display the Debug window.  In the Debug window, type the following line, and then press ENTER: "?Errormessage" Note that you receive the following error message: "There is no current context object."</li></ol>

REFERENCES

For more information about CodeContextObject property, search for "CodeContextObject" 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." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

Additional reference words: 7.00 7955

KBCategory: kbprg kberrmsg

KBSubcategory: PgmObj