DATA Statements Not Allowed in SUB or FUNCTION Procedures (31882)






This article was previously published under Q31882

SUMMARY

The DATA statement should be included in the list of statements prohibited in procedure-level code on Page 50 of the following manuals

  1. "Microsoft QuickBasic 4.0: Programming in Basic: Selected Topics"
  2. "Microsoft Basic Compiler 6.0: Programming in Basic: Selected Topics"
  3. Page 41 of the "Microsoft Basic 7.0: Programmer's Guide" manual.

MORE INFORMATION

The DATA statement documentation on Page 135 in the Basic language reference manual correctly states that "DATA statements can only be entered in the module-level code."

A module is defined as an individual source file, but "module level" is a special term with a different meaning. The glossary on Page 350 of the "Microsoft QuickBasic 4.0: Learning and Using QuickBasic" manual defines "module-level code" as follows:

(Module-level code is defined as) program statements within any module that are outside a SUB or FUNCTION definition. Error- or event-handling code and declarative statements such as COMMON, DECLARE, and TYPE can appear only at the module level.


Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB31882