Without seeing the code for your On Click event, I'm winging it here, but if
you change the first line of event subroutines (not your own custom subs)
from the way Access creates them, like adding or removing parameters, or
changing the sub's scope, then you will get errors similar to yours, if I
remember from my own experience. My error message was just a little
different, though, so this might not be the answer. I can reproduce this
message easily by removing the stock "Cancel as Integer" parameter from a
DblClick event sub:
The expression [On Click, Mouse Down, Key Down, etc] 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 (etc.)
* There may have been an error (etc.)
To test it, you could go into the VBA editor and change the name of the
existing On Click event, and create a new one by selecting your control from
the choices in the code window's upper left combo box., then select the On
Click event in the upper right combo box. You can compare this to the line
you had (before changing the name), or just paste the existing code into the
new sub framework.
The catch is that the problem may lie in *ANY* of the event procedures on
your form, not just the one that posts the error when you click on it.. It
would be the same issue: a sub that has a change in parameter or something.
If Access creates "Private Sub myCtrl_KeyDown(KeyCode As Integer, ByVal
Shift As Integer)", then that's how it must read, or Access will balk, and
the error may show up in events fired away from the problem control.
Like I said, the error I'm referring to is worded slightly differently than
the one you received, so this could be off base, but it could be worth
checking.
Having said all that, I googled for the error message and found this
newsgroup post answered by Allen Browne (Microsoft MVP) at
http://www.talkroot.com/archivee/index.php/t-29984_Help_--_getting_crazy_error_message!.html
Check it out. I hope something here helps.
Paul
---------------------------------------------------------------------
Hi Neal.
The database is partially corrupt.
1. Delete the problem form.
2. Compact the database.
3. Close it.
4. At the command prompt, enter something like this. It's all one line, and
include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\My Documents\MyDatabase.mdb"
5. Open it and compact again.
6. Open a code window, and choose Compile from the Debug menu. Repeat until
there are no compile errors.
7. Import the deleted form from a backup copy of the database.
Post back for further instructions if that still doesn't solve the problem.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Neal Tipton said:
Dear Group:
I have a subform with two buttons neither of which work properly. When
clicked each one produces the following error message:
"The expression On Click you entered as the event property setting produced
the following error: A problem occurred while Microsoft Access was
communicating with the OLE server or ActiveX Control."
Earlier when trying to write the VBA for the buttons I found that whenever I
clicked the "..." button on the On Click property, it sent me to a module
for another form. I had to delete the buttons completely and start over
again before it would send me to the appropriate module. Now I get the
message above.
Something else, just to see what would happen, I tried creating a command
button ("Command 16", I think it was) with an On Click subroutine that
couldn't fail:
Private Sub Command16_OnClick()
MsgBox ("OK")
End Sub
Again, the same @$#%& message! What's going on and how do I fix it?
Neal Tipton
---------------------------------------------------------------------