Access bug?

G

Garret

I'm working with an Access2000 database. I have a form with a
subform. In the subform I have some code in the Form_Current event,
and in the main form I have code in the Load event, Before_Update, and
a few other spots. All this was working fine and I was tweaking the
code a little to see results on the form and subform. One of the
times, I changed a little code (like 1 line) and tried to open the
main form and got this message:

The expression On Load 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 Procedure].
*there may have been an error in evaluating the function, event, or
macro.

Surprised at the sudden error that had nothing to do with what I
changed, I still went back and removed the lines of code I had
placed. However, I still got this message each time I tried to open
the form. If I keep on pressing "OK", it still gets the form to open
up, but I notice that none of my events no longer run on the form or
the subform.

Thanks for any help
 
J

John W. Vinson

I'm working with an Access2000 database. I have a form with a
subform. In the subform I have some code in the Form_Current event,
and in the main form I have code in the Load event, Before_Update, and
a few other spots. All this was working fine and I was tweaking the
code a little to see results on the form and subform. One of the
times, I changed a little code (like 1 line) and tried to open the
main form and got this message:

The expression On Load 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 Procedure].
*there may have been an error in evaluating the function, event, or
macro.

If you look at the form's Properties, what *is* visible in the On Load event?
It should be literally and exactly

[Event Procedure]

It's also possible that your database is corrupted. Have you tried Compact and
Repair, or decompiling? If you don't have a backup, *MAKE ONE NOW*; and check
the suggestions at

http://www.granite.ab.ca/access/corruptmdbs.htm


John W. Vinson [MVP]
 
G

Garret

I'm working with an Access2000 database. I have a form with a
subform. In the subform I have some code in the Form_Current event,
and in the main form I have code in the Load event, Before_Update, and
a few other spots. All this was working fine and I was tweaking the
code a little to see results on the form and subform. One of the
times, I changed a little code (like 1 line) and tried to open the
main form and got this message:
The expression On Load 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 Procedure].
*there may have been an error in evaluating the function, event, or
macro.

If you look at the form's Properties, what *is* visible in the On Load event?
It should be literally and exactly

[Event Procedure]

It's also possible that your database is corrupted. Have you tried Compact and
Repair, or decompiling? If you don't have a backup, *MAKE ONE NOW*; and check
the suggestions at

http://www.granite.ab.ca/access/corruptmdbs.htm

John W. Vinson [MVP]

Hey John,

I really can't explain it, but the error went away after an hour of
vain investigation.
However, I do know that I had [Event Procedure] in the event
properties where I had an event being run.
I'll compact and repair it now, and hope for the best. If anything
goes wrong, I'll post again.
 
G

Guest

You can get that error if you change the procedure declaration
for one of the form or control events. For example, change

Private Sub Form_Open(Cancel As Integer)
MsgBox "Hello"
End Sub

to
Private Sub Form_Open(Cancel As Integer,fred, fred)
MsgBox "Hello"
End Sub

Access exposes a (callback) property which allows you
to attach methods to events. If you put [event procedure]
into that property, Access calls a standard method, using
a standard naming convention (The property is an unusual
Access property, which most ole objects don't have. Most
OLE objects just call standard methods, which you can
supply. You see this when you drop an OLE object on to
a form: most OLE objects have methods in the VBA window
which are not shown on the Access property sheet)

If you have another procedure with the same name as the
standard procedure, but the procedure declaration does
not match, you get this error.

However, I would assume that a likely cause of this error
would be corruption of the compiled code. Even if your
source code has the correct declaration, if the compiled
code is corrupt, the compiled signature might not match
the calling signature. Decompile would probably fix that
problem.

(david)
 

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