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

Procedure Declaration Does not Match.

P: 4
I created a db which works fine in Access 2000 on Win2k, but those who have Access 2003 and XP (and Vista!), get errors running event procedures on a particular form:

The error looks like this:

"The Expression On Load you entered as the Event Property Setting produced the following error: The Procedure Declaration Does not Match Description of Event or Procedure having the same name."

The same errror comes up for all events called on that form, not just the OnLoad event. Nearly identical code on similar forms works fine.

The code for the OnLoad event is below. But it is never actually called. The error comes up before a breakpoint for the code.



Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3.   On Error Resume Next
  4.   Combo178.Value = Coc_ID.Value
  5.   CommandBars("Filter/Sort Only").Enabled = False
  6.  
  7. End Sub
  8.  
It's hard to debug since I don't get the error myself.

The initial code used the Sub declaration created by Access, when you go through the code builder for the event on the properties of the form.

In debugging, we tried various configurations that change whether or not the Sub parameters include "Cancel as Integer" we also tried removing the error handler, since the form that does work doesn't have the error handler.

We have also tried deleting the code for the event procedure and recreating the event procedure again from the form's propert box. and adding the code back in. Also, no luck.

Any other suggestions would be greatly appreciated.

Thank you.
Feb 14 '07 #1
Share this Question
Share on Google+
6 Replies


Rabbit
Expert Mod 10K+
P: 12,366
That's odd. I have Access 2003 running on XP and from what I can tell, that code should work fine. Have you checked out the other subs? Did you try compiling the code?
Feb 14 '07 #2

P: 4
That's odd. I have Access 2003 running on XP and from what I can tell, that code should work fine. Have you checked out the other subs? Did you try compiling the code?
I looked at other subs but nothing jumped out. I did notice that if I add an OnOpen event and add invalid parameters tied to built in events, I get the error message not just for the event I was testing with but for others as well, This led me to suspect that there is some other sub out there (or just a bad declaration) which I am not calling, nor can I see in 2000, but for some reason is being called in 2003, and that is causing a domino effect of these errors.

But I couldn't locate such an issue.

I haven't tried compiling the code, since I never really did so in the past with Access apps. But I will try it.
Feb 14 '07 #3

NeoPa
Expert Mod 15k+
P: 31,494
If you try to compile the code on one of these machines then it should report the problem to you (It's Access so don't rely too heavily on the error message - it's often pure garbage :(). It's worth a try anyway.
Feb 14 '07 #4

ADezii
Expert 5K+
P: 8,638
I created a db which works fine in Access 2000 on Win2k, but those who have Access 2003 and XP (and Vista!), get errors running event procedures on a particular form:

The error looks like this:

"The Expression On Load you entered as the Event Property Setting produced the following error: The Procedure Declaration Does not Match Description of Event or Procedure having the same name."

The same errror comes up for all events called on that form, not just the OnLoad event. Nearly identical code on similar forms works fine.

The code for the OnLoad event is below. But it is never actually called. The error comes up before a breakpoint for the code.



Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3.   On Error Resume Next
  4.   Combo178.Value = Coc_ID.Value
  5.   CommandBars("Filter/Sort Only").Enabled = False
  6.  
  7. End Sub
  8.  
It's hard to debug since I don't get the error myself.

The initial code used the Sub declaration created by Access, when you go through the code builder for the event on the properties of the form.

In debugging, we tried various configurations that change whether or not the Sub parameters include "Cancel as Integer" we also tried removing the error handler, since the form that does work doesn't have the error handler.

We have also tried deleting the code for the event procedure and recreating the event procedure again from the form's propert box. and adding the code back in. Also, no luck.

Any other suggestions would be greatly appreciated.

Thank you.
Sounds like it could be a case of 'Orphan Code". This can occur, for instance, when you have code placed in an Event of a certain Object and then you later rename that Object. When you look at the Event Procedure, the code is no longer there. In the Code Window of your Form select (General) in the Object Drop Down and (Declarations) in the Procedure List Drop Down. Now, expand the Procedure List - any 'Orphan Code' will now be listed there along with valid Code. Good luck.
Feb 15 '07 #5

P: 4
It compiled it, and I found two bits of code on other forms that needed fixing.
Ine was an extra "End Sub" on my start form, one stray "End if" some where else in the project, and an event procedure on a third form for a combo box that no longer existed, the compile error for this one only didn't because there was
a reference to the value of that combo box in the code.

I cleared that up, sent to my user who was having the problem (hence the delay) and received a reply that everything "seems to be working just fine"

so I don't know which of these issues caused the problem, but I seem to be okay, so thank you.all.
Feb 15 '07 #6

NeoPa
Expert Mod 15k+
P: 31,494
No problem :)
I'm just pleased that, between us, we were able to help you resolve your problem.
Feb 15 '07 #7

Post your reply

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