Error message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abouddan
    New Member
    • Feb 2007
    • 42

    Error message

    Hi all

    I am using Access2000 and in some form I'm just adding a command button that close that form on the event OnClick. When running the code and when clicking on that button an error message appears like the one below.
    After that I realized that every object that had an OnClick event or any other event the same message appears.
    It says:

    The expression On Click 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 evaluating the function, event, or macro.

    End of message.


    Any Ideas?

    [IMG]Error Message[/IMG]
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    We might if you could post the code. But from the error message it sounds like you might have accidentally changed Private Sub ControlName_OnC lick() to something else.

    Comment

    • abouddan
      New Member
      • Feb 2007
      • 42

      #3
      The real situation is that I am creating a form based on a table. And in that form their are many textboxes and comboBoxes and I have a commandBox that has in On Click event : DoCmd.Close
      And when I created that button I did it whith the creating wizard, so I changed nothing.

      Comment

      • scolivas
        New Member
        • Oct 2006
        • 56

        #4
        Abouddan,

        It looks like your wizard might be faulty.



        in design view - right click on the button, and select properties.
        select the event tab and check to see if the on click field is populated. if it is, click on the button at the end of the line w/...

        you code should look like this with the exception of your button's name:

        Code:
        Private Sub Command36_Click()
        On Error GoTo Err_Command36_Click
        
        
            DoCmd.Close
        
        Exit_Command36_Click:
            Exit Sub
        
        Err_Command36_Click:
            MsgBox Err.Description
            Resume Exit_Command36_Click

        if it says more than that...paste that data into the forum so we can see it.

        Sophie

        Originally posted by abouddan
        Hi all

        I am using Access2000 and in some form I'm just adding a command button that close that form on the event OnClick. When running the code and when clicking on that button an error message appears like the one below.
        After that I realized that every object that had an OnClick event or any other event the same message appears.
        It says:

        The expression On Click 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 evaluating the function, event, or macro.

        End of message.


        Any Ideas?

        [IMG]Error Message[/IMG]
        Last edited by NeoPa; Mar 27 '07, 11:25 PM. Reason: Tags

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          I've received this message more than once when I've been careless about pasting code into my form's module. What happened was that I inadvertently pasted code for one Sub into the middle of another Sub! Access expects to see the begining of a Sub, some code for the Sub, then Sub End. Instead, in reading down the line, so to speak, it now sees the beginning of a Sub, the beginning of another Sub, then two Sub Ends, and this confuses it! I'd scan your code, starting with the OnClick Sub for command button you just created, for an occurrence such as this.

          Comment

          • abouddan
            New Member
            • Feb 2007
            • 42

            #6
            Many thanks for the support

            I think what Missinglinq said was the right answer for me. What I did is the following: I commented all the code (I put ' at the biginnig of every row) except the code of the command button the one that closes the form, and I run the programm and it went ok, then I did the same thing for all Private subs one by one until I found the 'infected' Sub. I deleted the code and re-wrote it, and that was very good. BTW I cleaned all unnecessary code in that form.

            Comment

            Working...