Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Procedure declaration does not match... (XP)

    Here's a strange error message that's coming up when I load a form (or perform any action on the form that has a VBA event procedure attached to it):

    <font face="Georgia">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 evaluating the function, event or macro.</font face=georgia>

    I've checked and triple checked - the names of the event procedures are right, there's nothing wrong with the code inside them (I changed the code in Form_Load to <font face="Georgia">msgbox "hello world"</font face=georgia> to make sure, and still got the same error)... what is wrong and how do I fix it?!?


    (update): I've found this article on MSDN: BUG: Procedure Declaration Does Not Match Description of Event - which describes the same problem in VB. But I'm using VBA not VB and am not sure if I can implement the "steps to reduce behaviour" that they list. I'll keep looking for an equivalent article for VBA users but haven't had any success yet.

    (update 2): I've now found an article that does relate to this error message in Access: ACC2002: Error When You Run RecordExit Function or Sub Procedure. However, this article pins the blame on the idea that I have a sub called Form_RecordExit. I don't.

    Back to the drawing board...
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Procedure declaration does not match... (XP)

    If you like, you can copy the code from the form module into a text file, and attach that to a reply, so that Loungers can take a look at it.

  3. #3
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Procedure declaration does not match... (XP)

    Finally fixed it! The second article I posted says:
    <font face="Georgia">
    When you compile the project, you receive the following error message:
    Compile Error:

    Procedure declaration does not match description of event or procedure having the same name.
    The following line appears highlighted as the cause of the compile error:

    Sub Form_RecordExit()
    </font face=georgia>

    This is incorrect. When I compiled the project , I did receive that message, but the the line that was highlighted as the cause of the error was just a bog standard event (in my case, Sub Combo171_Afterupdate() ). So I cut this sub, and repasted it (I changed Combo171_AfterUpdate to Combo171_Change too) and suddenly everything is working properly again.

    Sometimes I just want to phone Bill Gates and say <img src=/S/bwaaah.gif border=0 alt=bwaaah width=123 height=15>
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Procedure declaration does not match... (XP)

    I'm glad you solved it. This kind of problem can be hard to get a grip on.

    BTW, the MSKB article mentioned one possible cause of the error message. There are others, as you have found.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •