Invalid outside of Sub or Function
The statement must occur within a Sub or Function procedure. Executable statements, Static , and ReDim can be used only in a Sub or Function procedure. In the Declarations section of a form or module you can use only comments and the declarative statements Declare, Deftype, Dim, Option, Global, Global Const, and Type.