VBA Code does not work on accdbe version of the database

João serras-pereira
João serras-pereira used Ask the Experts™
on
I have aworking database that I want to split (so future code changes are easily installed) and distribute.

As a first step I started by just generating an accde file (no split yet) to check everything. When I launch the new accde form (the database has only 1 form at this stage) my code does not run at all but yields no error messages.

On the user computer it yields a code error asking permission to run macros and then, when we give permission, does not run either...

any cluse?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
Commented:
In Access 2007, you must enable macros.  When you open the application in design mode you will likely get a security warning, similar to image#1 below (AccessSecurityWarning.jpg).  When you run it as an accde file, you will likely get #2 (AccessSecurityWarning2.jpg).

If you get the warning that looks like #1, then click the Options button and enable macros.  If you get #2, you should just need to click the Open button.

Another way to avoid this is to put the application in a folder that is identified as a "trusted location".  To do this, click the windows icon in the upper left corner of Access and click the "Access Options" button along the bottom edge of the form.

Click "Trust Center" in the left side frame, then click the "Trust Center Settings" button in the right side frame.  In the Trust center dialog box, click "Trusted Locations", then "Add a new location" and follow the rest of the prompts.  Finally, put your accde file in this folder.
AccessSecurityWarning.jpg
AccessSecurityWarning2.jpg
Most Valuable Expert 2012
Top Expert 2014

Commented:
You should also thoroughly test your application using the Runtime environment. You can simulate that environment by starting your databse with the /runtime switch. To do this, build a shortcut with this as the Target:

"full path to msaccess.exe" "full path to your db" /runtime

thanks to all!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial