Access 2007 Form OnLoad event not firing

Posted on 2011-10-24
Last Modified: 2012-05-12
I have a form with an OnLoad event procedure. The form works correctly in the folder in which the accdb was created, and in some other folders on my hd, but when I copy the accdb to my desktop and to some other folders on my hd the OnLoad procedure does not fire. For testing I inserted MsgBox "Open" as the first line in the procedure and also set a breakpoint on the procedure name line, but the procedure is bypassed entirely in some folders but not in others. I have tried compact/repair and decompile, but neither fixes the problem.

This is an app I intend to distribute to others, so I need to make sure it is going to work everywhere - does anybody have any suggestions?
Question by:dgmoore1
    LVL 47

    Accepted Solution

    My guess is that these are not "trusted locations", and you will probably see a button similar to that in the attached image on your screen when the form loads.

    Access 2007 and 2010 implement trusted publisher and trusted locations as a way to prevent macros and VBA code from firing without users first acknowledging the code.
    LVL 61

    Assisted Solution

    Have you used set the folders that this DB resides in up as 'trusted locations'?

    Author Closing Comment

    You're both correct - I've been developing in Access since version 1 but for some reason the "Trusted Location" issue keeps slipping my mind. I don't get the "macro nag" on my development workstation, and, come to think of it, this won't be an issue for my users because the security settings on their network force them to enable macros/code each time they open any Access/Excel/whatever application that contains code. The users hate this, but security remains unswayed.  Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now