none
Access 2007 Can't Run Macro / Trust Database

    Întrebare

  • I have downloaded an Access template for Time Card entry, and downgraded it to an MDB file so other users still on Access 2003 could use it.

    One of the inline macros will not work.  It gives me a message that the SetValue action will not run because the database is not trusted.

    My research indicates that I need to enable the content, but I am not getting that option when I open the database.  I used to, but all of a sudden the "Content has been disabled" message is not showing.  Googling the issue, I find that I need to enable the Message bar, but in Database Tools, the Message Bar checkbox is disabled.

    In the Trust Center, the "Show the Message Bar in all applications when content has been blocked" radio button IS selected.  The database is in a trusted location, which I had just added to the Trust Center.  Also, Macro Settings are temporarily configured to "Enable all macros".

    I even wrote an AutoExec macro to display a message box, whose content is simply:

    =[CurrentProject].[IsTrusted]

    This is just to see if it is indeed trusted.  This message box displays "-1", so it must be so.

    Now, the issue occurs even in a brand new database, so something seems to be broken in my Access.

    Any ideas how to solve this?  Thanks...


    Ron Mittelman

    2 martie 2012 00:03

Răspunsuri

  • Hi Ron,

    The database was designed to work in Access 2007 and embedded macros are new to Access 2007.  Access 2007 also has enhanced security.  We have the ability to save a database in an earlier format to allow for backwards compatibility but features new to Access 2007 aren't going to work for users with earlier versions of Access, so we need to avoid these new features when designing databases for use across multiple versions. 

    If we open an mdb in Access 2007, the embedded macros will run, but they'll only run the actions considered "safe".  Macro actions that are considered unsafe, such as SetValue, are disabled in the mdb file format. 

    By default, only "safe" actions are available in the list of macro actions, even if a database is trusted.  If you create a new standalone macro, you'll see that SetValue (among others) is not available in the list until you click on "show all actions".  If you create a new embedded macro in an mdb, you'll see that "show all actions" is disabled, therefore disabling these macro actions.  So all you need to do in this case is to save the macro as a standalone macro and reference it in the appropriate property on the form.

    I hope this helps!


    Sharon M, Microsoft Online Community Support

    • Marcat ca răspuns de RMittelman 14 martie 2012 19:06
    13 martie 2012 18:59

Toate mesajele

  • How did you downgrade it to an MDB file?

    Try creating a new MDB file using Access 2003.  Import all of the objects from the problem database.  See if that fixes the problem.


    http://www.saberman.com

    2 martie 2012 16:22
  • Hi saberman,

    How I downgrade it is simple.  In Access 2007, I click the round button thingy and choose Save As...  I choose 2000-2003 format.  It tells me I can't do that, because there are some 2007-only objects.  I remove the object field from the main table (which is there to store a picture), and remove the picture box which was bound to that field on the associated form, then it saves fine as an MDB file.

    I don't really have Access 2003, so I can't try your suggestion.

    The problem seems to be inherant in my Access 2007 program.  It was working fine, and now it is not.  Even if I create a new ACCDB database in a non-trusted location, I don't get the message anymore.  And I can't activate the message bar at all.

    Thanks...


    Ron Mittelman

    2 martie 2012 17:19
  • If you have enable all macros set you won't get the disabled content message because the content is not disabled.

    I am using Access 2010 and the setting for the Message Bar is in Trust Center / Message Bar.  Where are you seeing a checkbox for it?


    http://www.saberman.com

    2 martie 2012 21:14
  • You are correct.  I only chose enable all macros as a temporary test.  Still, when I run a macro in the template project (I run this by opening a form and changing the value in a drop-down), the error message comes up saying I can't run the SetValue action because  macros are disabled.

    The Message Bar checkbox I was referring to is in Access 2007, in Database Tools, Show/Hide section.  The checkbox is disabled.  I read that you can enable that by setting the option in the trust center.

    My complaint is that I cannot check the checkbox in Database Tools because it's disabled.


    Ron Mittelman

    2 martie 2012 22:03
  • Just tried a 2007 system and it is disabled there but it is enabled in the Trust Center.

    http://www.saberman.com

    3 martie 2012 00:12
  • I think we are losing sight of the real problem.

    My Access security seems to be broken for the following reasons:

    • If the DB is in a trusted location, it still refuses to run the macro, and tells me it fails on SetValue action because the macro/database is not trusted.
    • If the DB is NOT in a trusted location, I am not getting a warning message upon opening it.  I can't get the message bar to show, because the checkbox to do so is disabled, and Access is ignoring the setting in the Trust Center to show message bar.  If the message would show on opening the DB, I could choose "Enable this content".

    So can anyone help with this problem?  It DID once work properly, now it does not, even with a brand new database, even in ACCDB format.


    Ron Mittelman

    5 martie 2012 15:52
  • Ron Mittelman, I will help you involve others to help you. There might be some delay about the response. Appreciate your patience.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    7 martie 2012 02:30
  • Thanks Bruce.  I would appreciate that.

    Ron Mittelman

    7 martie 2012 15:41
  • Hi Ron,

    Both embedded macros and the IsTrusted property are new to Access 2007.  If you open the embedded macro and do a "save as" to save it as a separate object, it should run without error in Access 2007.  If you save the database as an MDB again, just be sure to remove the condition for SetValue so Access 2003 users won't get an error for the IsTrusted property.

    I hope this helps!


    Sharon M, Microsoft Online Community Support

    8 martie 2012 20:33
  • Hi Sharon,

    I'm not sure this helps at all.  In an Access 2007 DB, I should either be able to execute a macro with SetValue action (among others) or not, depending on whether it's in a trusted location or has been enabled, right?

    I can't get this to work properly (or what I think is properly).  If I trust the location the DB is in, the macro should work, whether it's in ACCDB or MDB format, if I'm running it in Access 2007, right?

    If it's not in a trusted location, I should get a message when I open the file, and click the button which brings up the trust center and allows me to enable the content or not, right?

    I am not getting that message.  I cannot get my message bar to appear, as the checkbox to show it is disabled.  Even though the setting in the Trust Center is to show the message bar, it does not show.

    If I trust the folder the database is in, then open the database, I should be able to run a protected action such as SetValue, but still it fails.

    How do I enable that checkbox to show the message?

    Thanks...


    Ron Mittelman

    8 martie 2012 21:50
  • Hi Ron,

    From what you've described, everything appears to be working normally.  Here are the answers to your questions.

    Q: In an Access 2007 DB, I should either be able to execute a macro with SetValue action (among others) or not, depending on whether it's in a trusted location or has been enabled, right?

    A: Yes, placing the db in a trusted location or enabling content will both allow macros to run, as long as it’s a .accdb file.

    Q: I can't get this to work properly (or what I think is properly).  If I trust the location the DB is in, the macro should work, whether it's in ACCDB or MDB format, if I'm running it in Access 2007, right?

    A: Not necessarily.  This is explained further below. 

    Q: If it's not in a trusted location, I should get a message when I open the file, and click the button which brings up the trust center and allows me to enable the content or not, right?

    A: Not necessarily.  There’s an option in the Trust Center that will suppress this message called  “Never show information about blocked content”.  To get to the Trust Center, click on the Office button/Access Options/Trust Center.  If you then click on Trust Center Settings/Message Bar, you’ll see the this option.

    Q: I cannot get my message bar to appear, as the checkbox to show it is disabled. 

    A: As Saberman mentioned above, only the check box on the ribbon (Database tools/ Show Hide section) is disabled.  The option in the Trust Center is enabled. 

    Ribbon check box:  Is enabled if the database isn’t trusted but disabled if it is trusted.
    Trust Center check box: Enabled whether the db is trusted or not.

    Q: Even though the setting in the Trust Center is to show the message bar, it does not show.
    A: The message bar never displays if the db is trusted.   

    Q: If I trust the folder the database is in, then open the database, I should be able to run a protected action such as SetValue, but still it fails.

    A: Not necessarily.  If the macro is saved as an object viewable in the Macros section of the navigation pane, and “show all actions” is selected in the macro, then it should run.  If the macro is embedded into a form, some actions will not work in .mdb files.   


    Sharon M, Microsoft Online Community Support

    12 martie 2012 11:47
  • Sharon,

    Thanks for the concise reply.  Even though your answers indicate that I have not conveyed the problem properly, I have made some progress.

    I told Access to trust all macros. Before you yell at me, this is a temporary measure to debug the problem.  This seems to set the Trusted flag to true, even if the DB is not in a trusted location.  Changing this back to "Disable macros with Warning" seems to fix the checkbox-on-the-ribbon issue, and in fact causes the macro warning message to start working again.

    Before, even though I set the Trust Center option to show the message bar when the content is blocked, it wasn't doing so.  This also seems to be related to the above reason.  In fact, all of the questions and answers, except for the last one, are directly related to the above reason.  All now works properly, with regard to seeing the warning message when opening the database.

    The only issue seems to be that the SetValue action won't work.  It's in an embedded macro.  What's the deal with embedded macros when the accdb has been saved as an mdb (downgraded to 2003)?  The embedded macro still runs, but the SetValue doesn't.  Even if the database is trusted (either digitally signed, in a trusted location, or just told to run all macros), that action doesn't work.  Can you explain this?  Presumably I could take out the embedded macro and save it as an object, and only embed a RunMacro command, right?

    Thanks again...


    Ron Mittelman

    12 martie 2012 16:51
  • Hi Ron,

    The database was designed to work in Access 2007 and embedded macros are new to Access 2007.  Access 2007 also has enhanced security.  We have the ability to save a database in an earlier format to allow for backwards compatibility but features new to Access 2007 aren't going to work for users with earlier versions of Access, so we need to avoid these new features when designing databases for use across multiple versions. 

    If we open an mdb in Access 2007, the embedded macros will run, but they'll only run the actions considered "safe".  Macro actions that are considered unsafe, such as SetValue, are disabled in the mdb file format. 

    By default, only "safe" actions are available in the list of macro actions, even if a database is trusted.  If you create a new standalone macro, you'll see that SetValue (among others) is not available in the list until you click on "show all actions".  If you create a new embedded macro in an mdb, you'll see that "show all actions" is disabled, therefore disabling these macro actions.  So all you need to do in this case is to save the macro as a standalone macro and reference it in the appropriate property on the form.

    I hope this helps!


    Sharon M, Microsoft Online Community Support

    • Marcat ca răspuns de RMittelman 14 martie 2012 19:06
    13 martie 2012 18:59
  • Hi Sharon,

    I am having a somewhat similar problem with SetValue, only I keep getting the message, "the expression you entered has a function name that Microsoft Access can't find." And "error 2425."

    My situation is different.  I am a piano technician and keep my records in Access.   The macros functioned perfectly in Access 2003.  (I originally set most of them up in Access 1.0 and then upgraded to 97 and later 2003). A week ago I upgraded from Access 2003 to Access 2010.  I placed the database in a trusted folder and have converted it to .accdb  I have spent many hours trying to get the action macros to run, and have to get on with my work.  In desperation I enabled all macros, but with no success.  Can you help me?

    I tried to copy one of the macros:

    <?xml version="1.0" encoding="UTF-16" standalone="no"?>
    <UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><UserInterfaceMacro MinimumClientDesignVersion="14.0.0000.0000"><Statements><Action Name="SetValue"><Argument Name="Item">[date of last update]</Argument><Argument Name="Expression">Date()</Argument></Action></Statements></UserInterfaceMacro></UserInterfaceMacros>

    25 martie 2012 00:14
  • Dear Sharon

    I am also facing similar problem as Ron.

    I have gone trough all the steps told by you ie put the file in trusted location, enabled all macros, pressed "show all macro action", checked the radio button to show the message and  saved the macro as standalone macro . In addition I also disabled the sand box mode but still the problem persist.

    Interestingly one action in which i am changing value through a code (ie VBA) is working fine in win XP but not working in win7. After breaking my head for few days I downgraded to Win XP and hence the problem is partially solved.

    But still one macro where in I am using setvalue action through a standalone macro is not working even in Win XP.

    I am very sure there is a bug somewhere as setvalue action is working in one case but not in other. in following case it is working

    [Screen].[ActiveControl].[Value], =[Screen].[ActiveControl].[Value]+1

    But in following case it is not!!!

    [Forms]![Expenditure Entry Range wise]![Form1].[SourceObject], "subform_ for_labour_vouchers"

    I am hopeful that you will be able to help.

    Regards

    S K srivastava

    

    19 aprilie 2012 16:27
  • Dear Sharon

    After posting the reply I found that error was in the form itself. the macro was working fine but the effect was not visible as there was error in the form itself.

    So to Ron, my advice would be to try the same file on win XP after ensuring following

    1. put the file in trusted location
    2. enable all macros
    3. press"show all macro action"
    4. checked the radio button to show the message
    5. save the macro as standalone macro .
    6. disable the sand box mode

    Regards

    S K Srivastava

    19 aprilie 2012 17:29