What is a procedure declaration?

G

Guest

I am getting the message "Procedure declaration does not match description of
event or procedure."
It started when I wrote the following procedure for an Access 2002 database:
Private Sub Form_Open()
On Error GoTo Err_Form_Open

If Living Then
Text82.Visible = False
DeathYear.Visible = False
DeathCause.Visible = False
End If

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Description
Resume Exit_Form_Open

End Sub
When I added this as the first of a list of procedures, most of which were
working fine, the others started giving me the same error message.
I know I have done something stupid. Can anyone tell me what it is?
 
A

Allen Browne

The form's Open event has a Cancel argument, so the way you declared the
procedure does not match what Access expects to find there.

Try
Private Sub Form_Open(Cancel As Integer)
 
G

Guest

Hi Jerry
you are missing Cancel As Integer between the parenthesis. Add it in this way:
Private Sub Form_Open(Cancel As Integer)
HTH Paolo
 
G

Guest

Thank you very much. That allowed me to open the form, but I got a message
"Type Mismatch."
 
M

mcescher

Thank you very much. That allowed me to open the form, but I got a message
"Type Mismatch."






- Show quoted text -

What line does it break on? It should tell you where the error is.

Where is the Living variable setup? What is the value of it when it
crashes. Is it Null?

HTH,
Chris M.
 

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