Microsoft KB Archive/94695

= Error: Executable code not allowed in module level of a form =

PSS ID Number: 94695

Article Last Modified on 1/8/2003

-

The information in this article applies to:


 * Microsoft Visual Basic for MS-DOS 1.0

-



This article was previously published under Q94695



SUMMARY
You can't use the On Error Goto and On Event Gosub statements in a form because they require an event handler at the module level, and you can't enter code at the module level of a form.

Attempting to enter code at the module level of a form results in an error:

Executable code not allowed in module level of a form

Line labels and line numbers are allowed in the module level of a form module, but they are useless.

To work around this limitation, use On Error and On Event statements only in code (.BAS) modules or use the On Local Error statement for error trapping.



MORE INFORMATION
This limitation applies to the following statements:   On Error       On Com On Key        On Pen On Play       On Strig On Timer      On UEvent

Additional query words: VBmsdos 1.00

Keywords: KB94695

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.