ACC: Error Message "Method or Data Member not Found"Last reviewed: August 28, 1997Article ID: Q151572 |
The information in this article applies to:
SYMPTOMSAdvanced: Requires expert coding, interoperability, and multiuser skills. When you compile a module in which a procedure is attempting to call a procedure defined in a class module in another database, you may receive the following error message:
Method or Data Member not Found. CAUSEClass modules are private in scope to the Visual Basic project in the database in which they are defined. Therefore, procedures in class modules cannot be referenced in another Visual Basic project. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.
RESOLUTIONYou can use one of the following two methods to work around this behavior.
Method 1Store the procedure in a standard module rather than a class module. This would make the procedure directly accessible from other databases but would require that you convert your class module procedures to standard module procedures.
Method 2Create a function in a standard module in the database where the class module is defined. This function would call the procedure from the class module. Then, you would call this function from a standard module of another database. This allows you to leave your class module procedures as is, but would require that you write a standard procedure for each class module procedure you wish to run.
MORE INFORMATIONAlthough its not possible to directly call a procedure defined in a class module of another database from procedures outside of that database, you may notice that it is possible to call them from the Debug window. This is because Visual Basic for Applications relaxes privacy rules and scope restrictions in the Debug window to aid in debugging Visual Basic procedures.
Steps to Reproduce Behavior
REFERENCESFor more information about creating references to other databases, search the Help Index for "Referencing, Other Databases," or ask the Microsoft Access 97 Office Assistant. For more information about class modules, search the Help Index for "Class Modules," or ask the Microsoft Access 97 Office Assistant. Keywords : kberrmsg kbprg PgmHowTo Version : 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbprb Solution Type : Info_Provided |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |