• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Troubleshooting

Calling Procedures and Functions in Class Modules

Q1: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.
A1: 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

Q1:“Object not found in this collection” errors occur with explicit object names or values passed as argument values.
A1: 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 don't obtain the expected name, replace 0 with increasing values.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint