Empty "Form_Open" error?

  • Thread starter Thread starter Miss Teacher
  • Start date Start date
M

Miss Teacher

Hi!

Thanks in advance for your time.

I have a form that, upon opening the form, I get the following error:

"The expression On Open you entered as the event property setting produced
the following error: Procedure declaration does not match description of
event or procedure having the same name.

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procdure].
*There may have been an error evaluating the function, event, or macro."

There are no macros on my form. Initially I tried commenting out each line
in turn in order to locate the offending line in my event, then I commented
out ALL the lines, leaving the event empty. All this produced the same error.
Only when I commented out the existence of the event entirely did the message
not appear. Here is my form_open event:

Private Sub Form_Open(Cancel As Integer)
'ChooseOutcomes.Enabled = False
'CriteriaSheet.Enabled = False
'Notes.Enabled = False
'lstAssessmentName.SetFocus
'lstAssessmentName = lstAssessmentName.ItemData(0)
'Call lstAssessmentName_AfterUpdate
End Sub

Why would an empty event cause an error on opening my form?
 
A thought, is the form based on a query? Have you tried running the source
query, does it show any error? Please ignor my previous post I was thinking
of something else which I don't think applies

Regards

Mike B
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


MikeJohnB said:
What is the name of your form????
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


Miss Teacher said:
Hi!

Thanks in advance for your time.

I have a form that, upon opening the form, I get the following error:

"The expression On Open you entered as the event property setting produced
the following error: Procedure declaration does not match description of
event or procedure having the same name.

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procdure].
*There may have been an error evaluating the function, event, or macro."

There are no macros on my form. Initially I tried commenting out each line
in turn in order to locate the offending line in my event, then I commented
out ALL the lines, leaving the event empty. All this produced the same error.
Only when I commented out the existence of the event entirely did the message
not appear. Here is my form_open event:

Private Sub Form_Open(Cancel As Integer)
'ChooseOutcomes.Enabled = False
'CriteriaSheet.Enabled = False
'Notes.Enabled = False
'lstAssessmentName.SetFocus
'lstAssessmentName = lstAssessmentName.ItemData(0)
'Call lstAssessmentName_AfterUpdate
End Sub

Why would an empty event cause an error on opening my form?
 
Check to be sure that you do not have two procedures in the form's module,
both with the name Form_Open. If there is more than 1, delete the other(s).

Then, after you've commented out the current procedure, go to design view of
the form and start a new event procedure for On Open property. When you get
to the VBA window, copy the code from the current, commented-out procedure
into the new event procedure. Remove the comment ' characters from the code
steps in the new event procedure. Then delete the commented-out, original
event procedure lines.

Does that resolve the problem?
 
Back
Top