error on opening form

  • Thread starter Thread starter smk23
  • Start date Start date
S

smk23

I start getting the following error message on opening nearly every form in
my application:
"The expression On Current you entered as the event property setting
produced the following error: statement invalid outside type block."

The form I was opening does have code on the On Current event, but when I
put a breakpoint there, it never gets to the code. The form proceeds to open
and seems to otherwise function normally except if I click a command button,
I get the same line with "the expression On Click..." I can't find a way to
debug this. Any ideas appreciated.

Thanks,
Sam
 
Just found the answer, FYI in case anyone else gets this weird situation:
I had declared a variable in a module header of a form but forgot the "Dim".
This affected nearly every form in the application. I would have found this
faster if I had compiled my code (which I can't believe I hadn't).

Thanks,
Sam
 
smk23 said:
I start getting the following error message on opening nearly every form in
my application:
"The expression On Current you entered as the event property setting
produced the following error: statement invalid outside type block."

The form I was opening does have code on the On Current event, but when I
put a breakpoint there, it never gets to the code. The form proceeds to
open
and seems to otherwise function normally except if I click a command
button,
I get the same line with "the expression On Click..." I can't find a way
to
debug this. Any ideas appreciated.

Thanks,
Sam

Sounds like you have an expression in the form's OnCurrent Property. Open
your form in design view, open the property sheet and click on the Event
tab. If you have any entries starting with an equals sign, these are
probably the cause of your problem. Ensure that all events that you expect
to execute VBA code in an event procedure have the text [Event Procedure]
instead.
 
Back
Top