the expression On-click you entered as event property setting is causing the error while CDI was communicating with the OLE server or Active X control.

O my app I started, suddenly , to get the error:

"the expression On-click you entered as event property setting is causing the following error: a problem occurred while CDI was communicating with the OLE server or Active X control..."
It suddenly started and is starting to happen i  all events in the form (clicks, close, etc... and traps do no function.

Can anyone help me tracking the bug and recover?
João serras-pereiraAsked:
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
This sometimes means corruption. To try and resolve that:


1. Compact the database
2. Compile your code - from the VBA Editor window click Debug - Compile. Fix any errors, and continue doing this until the menuitem is disabled
3. Compact again

If that doesn't work you may need to decompile the database. To do that, create a Shortcut with this as the shortcut:

"full path to msaccess.exe" "full path to your database" /decompile

Run that shortcut, then run the 3 steps above again.

You may also need to create a new database and import everything into the new database. If you do this, run the 3 steps above on the new db after import.

You may also have a corrupt object. If so, often the import into a new database will complain when trying to move that object. If that happens, then you'd have to bypass that object, and recreate it from a recent backup (or from scratch).

If none of these work you may have to hire a recovery service like
João serras-pereiraAuthor Commented:
It was corruption and it is becoming a real pain
I can´t tell why it decided to go corrupt but, in reality destroyed (hopefullY) only one form.
As I was suspecting on corruption, I took a very old design of the form and imported it. I am keeping several backups of the database and, from now on I am always making a backup of the form before starting to modify it. But I really need to drop ms/access altogether

Bugs like these are costing me a heavy load in lost development hours

Thanks for the help (and for the link)
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Corruption can occur for many things, but some of the more important ones to consider during development in Access:

1. Always work on a local copy of the database. For example, don't place your Frontend on a server, and then launch Access on your local machine and open that server-based copy. Instead, pull a copy down from the server to your local machine and work on that one.

2. NEVER made code changes in break mode. Instead, stop the process, open the object in Design view, and make the changes.

3. Save your work often, and make backups regularly. Making a backup is a simple as finding the file in Windows Explorer and pressing Ctrl+C and then Ctrl+V.

4. Compact your code regularly during development. Before compacting, make a backup.

5. Turn OFF Name Autocorrect

6. Be sure to follow proper coding standards. For example, one of the more common issues if when you fail to Close objects that you open.

7. Make sure your development machine is fully up to date in regard to Windows and Office.

8. Always work with a split database - a Backend (the tables only) and a FrontEnd (everything else). Monolithic databases tend to corrupt more frequently than others.

There are other causes for corruption, but those have more to do with environment rather than development.
João serras-pereiraAuthor Commented:
Thanks again!
Of all your advices. I do not regularly follow 5 (I do not know what it is but will browse a bit to learn) and 8 (I tend to use the split at a later stage in development but after advice... will change habits ASAP)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.