ms-accessms-access-2007ms-access-2010

accde ran using runtime stops any code from executing


I've upgraded an old access 2003 database to access 2010. The original database was split with an access front (installed to the clients) and back end (residing on the server). The new database uses access for the front end but the back end has been moved to SQL server.

Once it was finished I created an accde file and packaged that up in an installer to distribute it to all the client pcs. The installer creates a desktop shortcut that runs access 2010 in runtime mode and starts the front end database.

I tested it locally and on my development PC everything is fine. But on a test client pc (with Office 2010 installed) it gives an error upon opening the database that stops all code being executed. This is obviously a pretty major error and stops anyone from using the database.

The error is

The expression On Current you entered has the event property setting produced the following error
The expression may not result in the name of a macro, the name of a user defiend function, or event procedure.

I have ensured that the database is in a trusted location and tried it with all macros enabled but still get the same error. Before creating the accde I have also ensured that all the code compiles.

I've manually copied the accde file across on a clean test pc to check if it was a problem with the installer and even opening the accde in full access (ie not using the /runtime flag) gives the same error. If I copy the accdb file to the client pc then it runs fine, but obviously distributing an accdb isnt a secure way of running the database.

I've also tried creating a blank access 2010 db and importing all of the objects from the updated version (which was an mdb file that was converted to accdb) to check its not a problem with the way access converted the original mdb - still the same error.

Has anyone come across this error before/can shed some light on it for me, I'm well and truely stumped.

EDIT: After playing around on the test client pc I've noticed that if i open the accdb file and then save it as a accde, overwriting the installed version, then it will work fine. but this obviously adds a massive over head to installation to all the clients and removes the ability to automate it. so its not really a viable solution in itself... hopefully it points someone in the right direction.

EDIT2: I've also checked and confirmed that all the references are intact ie dll/ocx/etc and present on the test client pc


Solution

  • This does sound a like a typical broken reference issue.

    I would ensure that the VBA references are at a absolute min here. (on your dev machine, create a blank accDB file, and then in the VBA editor look at the default references – that's what you want for your production accDB that you will then compile into a accDE).

    I would also consider doing a de-compile on your accDB BEFORE you compile the code into accDE.

    Also the SP1 office update is causing problems with VBA corruption. If your references are ok (AND you are using late binding for any automation of word/outlook etc.), then I would consider after installing SP1 then ALSO install the VBA hotfix for saccess 2010. So try this with both sp1 + the code hotfix.

    VBA hotfix here: http://support.microsoft.com/kb/2596585

    The above is rather new – from oct 25, but you want to ensure you check/test the other steps first else you will be on a wild goose chase that could cause you more grief here.