Troubleshooting

graphics/troubleshooting.gif

Calling Procedures and Functions in Class Modules

After adding test code to a form class module, I encounter a "Compile Error - Sub or Function not defined" error message when running the code from the Immediate window.

To execute subprocedures or functions in class modules from the Immediate window, you must preface the name of the subprocedure or function with the name of the class module. For example, if you add the PrintCommandBars function to the Main Switchboard form's class module, and type PrintCommandBars in the Immediate window, you get the error message. You must preface the command with the class module name, as in [Form_Main Switchboard].PrintCommandBars. (Add the square brackets only if the form name contains a space.) You also must add the class name prefix when calling with code subprocedures or functions from another class module or conventional module. You don't need to add the form name prefix to call public functions in conventional modules.

Missing Objects in Collections

"Object not found in this collection" errors occur with explicit object names or values passed as argument values.

You misspelled the object name or failed to assign a value to an argument variable. To check the names of objects, especially those with long or convoluted names, type ? CollectionName (0) in the Immediate window to return the name of the first collection. If you receive an error or don't obtain the expected name, replace 0 with increasing values.



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net