By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,742 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,742 IT Pros & Developers. It's quick & easy.

Error message

abouddan
P: 42
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]
Mar 24 '07 #1
Share this Question
Share on Google+
5 Replies


Rabbit
Expert Mod 10K+
P: 12,359
We might if you could post the code. But from the error message it sounds like you might have accidentally changed Private Sub ControlName_OnClick() to something else.
Mar 24 '07 #2

abouddan
P: 42
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.
Mar 24 '07 #3

P: 56
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command36_Click()
  2. On Error GoTo Err_Command36_Click
  3.  
  4.  
  5.     DoCmd.Close
  6.  
  7. Exit_Command36_Click:
  8.     Exit Sub
  9.  
  10. Err_Command36_Click:
  11.     MsgBox Err.Description
  12.     Resume Exit_Command36_Click

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

Sophie

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]
Mar 24 '07 #4

missinglinq
Expert 2.5K+
P: 3,532
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.
Mar 24 '07 #5

abouddan
P: 42
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.
Mar 27 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.