Out of the blue I get this error

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Out of the blue I get this error

Post by Peter Kinross »

Out of the blue I get this error:
"Procedure declaration does not match description of event or procedure having the same name". Pointing to this procedure:

Code: Select all

Private Sub txtMobPhContact_Click(Cancel As Integer)
DoCmd.OpenQuery "qryMobilePhNumbers", acViewNormal
Me![txtFocusRcv].SetFocus
End Sub
If I comment out that procedure it gives the same error for the next (similar) one. ditto if I repeat for that one and ditto, ditto.
These procedures have been working beautifully for decades. Why now? I can't make head or tail out of the MS explanation.
In the data source query I added a field SpclEmail:SpclLtr, when SpclLtr is already there. But the code compiled with that change, so can't be that. I renamed a few buttons that were labelled to do with letters into the proposed use with emails, and changed the procedure names accordingly (not the ones causing the error). But can't see how that would effect anything.
Thinking out loud: maybe reached MSs crazy form control limit (there are a LOT on this form). Is there any way to re-set that counter?
I had a form corrupt on me a few weeks back, as near as I can tell it was the Calibri font that was the culprit - removed that and the form was fine. But no Calibri on this form.
Avagr8day, regards, Peter

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Out of the blue I get this error

Post by HansV »

The On Click event procedure of a text box does not have an argument, so the syntax should be

Code: Select all

Private Sub txtMobPhContact_Click()
Best wishes,
Hans

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Out of the blue I get this error

Post by Peter Kinross »

So simple, yet so far out of my knowledge. Strange thing is is that these subs have remained unchanged as shown for decades, working without a hitch. Not strange - weird!
ThanksHansStamp.gif
I'm going to have to get another stamp 'AGAIN' . maybe AGAIN2 :laugh:
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter

User avatar
SpeakEasy
4StarLounger
Posts: 548
Joined: 27 Jun 2021, 10:46

Re: Out of the blue I get this error

Post by SpeakEasy »

>these subs have remained unchanged as shown

Which oddly suggests that previously they were not actually being called! And even more oddly, event prototypes are typically generated by the IDE (rather than created by the programmer)

Are we sure noone has accidentally done a search and replace for, replacing Change with Click for some reason? The Change event does have a Cancel parameter

User avatar
Peter Kinross
5StarLounger
Posts: 962
Joined: 09 Feb 2010, 00:33
Location: Patterson Lakes, Victoria, Australia

Re: Out of the blue I get this error

Post by Peter Kinross »

You got it! ! !
They were on Double Click events. Cannot recall doing a global Find & Replace, especially for 'Click', but I must have.
Hans, the way your mind comes to grip with these stymies of mine and then logically zeros in on the solution is far more than amazing.
I don't have a stamp big enough.
So instead a heartfelt Thanks.
Avagr8day, regards, Peter

User avatar
SpeakEasy
4StarLounger
Posts: 548
Joined: 27 Jun 2021, 10:46

Re: Out of the blue I get this error

Post by SpeakEasy »

We are all Hans ...

User avatar
Leif
Administrator
Posts: 7209
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: Out of the blue I get this error

Post by Leif »

SpeakEasy wrote:
16 Aug 2022, 11:52
We are all Hans ...
:laugh:
Leif