ACC2000: "Method or Data Member not Found" Error MessageID: Q198650
|
When you compile a module that has a procedure which tries to call another procedure that is in a class module in another database, you may receive the following error message:
Method or Data Member not Found.
Class 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.
Use one of the following two methods to work around this behavior.
Although you cannot directly call a procedure defined in a class module of another database from procedures outside of that database, you may notice that you can call them from the Immediate window. The reason for this is that Visual Basic for Applications relaxes privacy rules and scope restrictions in the Immediate window to aid in debugging procedures.
Option Compare Database
Option Explicit
Public Function ClassModuleTest()
MsgBox "Hello"
End Function
? [Class].Form_ClassForm.ClassModuleTest()Note that the procedure runs and the "Hello" message box is displayed.
Public Function RunClassProc()
Dim x
x = [Class].Form_ClassForm.ClassModuleTest()
End Function
Compile Error:
Method or Data Member not Found.
For more information about creating references, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type
references property in the Office Assistant or the Answer Wizard, and
then click Search to view the topic.
For more information about class modules, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type
class modules in the Office Assistant or the Answer Wizard, and
then click Search to view the topic.
Additional query words:
Keywords : kberrmsg kbprg
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: August 9, 1999