"Statement invalid outside Type block" Access 97 VBA Module

  • Thread starter Thread starter StarfishJoe
  • Start date Start date
S

StarfishJoe

So far all I've done was key in some vb code, copied ( or rather--
"modeled" ) from a VB app into an Access97 app that merely enables and
disables controls on a form based on other controls on the form. I did not
cut and past, but rather assumed the same principles would work.

I went to test my code to see if the forms behavior was as desired, and I
got this message.
I saw nothing in Knowledgebase.

Any Ideas why this message typically comes up?

StarfishJoe
 
StarfishJoe said:
So far all I've done was key in some vb code, copied ( or rather--
"modeled" ) from a VB app into an Access97 app that merely enables and
disables controls on a form based on other controls on the form. I
did not cut and past, but rather assumed the same principles would
work.

I went to test my code to see if the forms behavior was as desired,
and I got this message.
I saw nothing in Knowledgebase.

Any Ideas why this message typically comes up?

StarfishJoe

I haven't seen that message before, but it's telling you that you've
used a statement that can only be used inside the definition of a
user-defined type; that is, between a Type statement and an End Type
statement. Possibly you tried to declare a variable without the Dim
keyword, like this:

foo As Integer '*** WRONG

Unless that variable was supposed to be part of a user-defined type, you
need the Dim keyword (or else, maybe, one of the keywords Public,
Private, or Static) to identify that this is a variable declaration:

Dim foo As Integer

If that doesn't help you find the problem, post the code.
 
Thanks.
I just figured this out before I saw your post.
(duh!!) I had several variables declared and forgot to precede them with a
"Dim".
StarfishJoe
 
Back
Top