Procedure declaration error

R

Rob Parker

I've got a form with coding for a number of controls/events, which is
currently giving me the following error message when I open it:

"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."

There is some additional info in the error message box suggesting possible
causes, but no further help accessible from there; and the help file hasn't!

If I comment out the Form_Open code, the error becomes "The expression On
Current ..."

If I comment out the Form_Current code, the error becomes "The expression On
Click ..." and it occurs when I click any of the command buttons on the form
(there are a number of them).

Setting breakpoints in the code is to no avail - the error occurs first and
the particular sub code never gets entered.

The form has a subform, with two subs; but I don't think that's the problem,
since if I comment out all the subform's code I still get the error.

I've seen this error when I've had a mismatch between the number of openargs
in a call to a sub and the sub's declaration, but that's not the case here -
there are only two subs on the form which have openargs, and they are always
called correctly from other subs in the form.

Any suggestions as to where I should look, and what I should look for, would
be gratefully received - this is driving me crazy.

TIA,

Rob
 
M

Marshall Barton

"Rob Parker" <CUT_THIS robpparker at optusnet dot com dot
au said:
I've got a form with coding for a number of controls/events, which is
currently giving me the following error message when I open it:

"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."

There is some additional info in the error message box suggesting possible
causes, but no further help accessible from there; and the help file hasn't!

If I comment out the Form_Open code, the error becomes "The expression On
Current ..."

If I comment out the Form_Current code, the error becomes "The expression On
Click ..." and it occurs when I click any of the command buttons on the form
(there are a number of them).

Setting breakpoints in the code is to no avail - the error occurs first and
the particular sub code never gets entered.

The form has a subform, with two subs; but I don't think that's the problem,
since if I comment out all the subform's code I still get the error.

I've seen this error when I've had a mismatch between the number of openargs
in a call to a sub and the sub's declaration, but that's not the case here -
there are only two subs on the form which have openargs, and they are always
called correctly from other subs in the form.

Any suggestions as to where I should look, and what I should look for, would
be gratefully received - this is driving me crazy.


I have no idea where the error is, but the first thing I
would do is to open the form's module and try to compile.
Most likely it won't and that's why Access can't run any
code in the module.
 
R

Rob Parker

Thanks Marsh,

Seems like the Compile tool could be useful for errors such as this. I've
never used it (and don't even understand exactly what it's for - guess it's
time for some more reading!). But it showed me what my problem was: a
BeforeUpdate handler that I'd generated by editing the name of a LostFocus
handler, and which was therefore missing the (Cancel as Integer)
declaration.

Your advice was much appreciated.

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top