Results 1 to 7 of 7
  1. #1
    maxis is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    30

    AUTOEXEC Macro- How to test if user is running Access 2003 or 2010 to skip .istrusted

    We have users on both XP/Access 2003 and Win7/Access 2010. I want to use the .istrusted to show a form to tell the user to select the ENABLE macro on the Security Bar.

    But .istrusted is not valid for the ACCESS 2003 users and the AUTOEXEC macro has to work for both users. I tried using a function in VBA to get the Access Version number - GetAccessVersion(), but in ACCESS 2010 it won't run the VBA code until after you ENABLE macro on the Security Bar.

    I've tried to use the following in the MACRO CONDITION column
    Dir("C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE")=""
    as the first line in the AUTOEXEC macro and it works just fine for the ACCESS 2003 users. If the Office14 folder isn't there, I assume you're an Access 2003 user and skip the .istrusted logic for the ACCESS 2010 users. It does NOT work for the Access 2010 users.

    Likewise, I tried to use this in the MACRO CONDITION column
    SysCmd(acSysCmdAccessVer)=11 with thet same results as the Dir Function.



    I need a MACRO CONDITION that will work in the AUTOEXEC MACRO for Access 2003 and 2010 users that will skip the .istrusted logic (enable macro form) if the users is running XP/Access 2003, or not skip the .istrusted logic if the users is running windows7/Access 2010. The database is always ACCESS 2003 .mdb file.

    Please help.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I take it you don't simply want to lower the macro warning threshhold in access 2007+?

    If you don't want to do that you could use a filesystemobject to detect whether or not a path exists (would let you check to see if a 2010 directory exists)

  3. #3
    maxis is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    30
    We don't control security, corporate IT does and the ENABLE comes up everytime for the ACCESS 2010. They hate ACCESS Databases too, so they're not helpful. Which is okay actually, but I'll look into the filesystemobject and see if I can figure it out. I don't use macro's much, always go the VBA route, but thanks in advance. I'll see if I can make filesystemobject work on the condition line of the macro.

  4. #4
    maxis is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    30
    [FileSystemObject].[FolderExists]("c:\program files\")=True

    Tried this; doesn't work. Maybe syntax is wrong. Access 2003 can't find name FileSystemObject.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    no you'd have to do something like

    Code:
    dim fs
    dim sFolder as string
    
    set fs = createobject("scripting.filesystemobject")
    sfolder = "c:\programfiles\"
    
    if fs.folderexists(sfolder) then
       'do what you're going to do if the folder is there
    else
       'do whatever else
    endif

  6. #6
    maxis is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2013
    Posts
    30
    I can do it in vba code, but the AUTOEXEC macro won't run VBA code until AFTER you ENABLE MACRO in Access2010. I need a CONDITION line in the macro that will work for BOTH Access 2003 (doesn't check for ENABLE MACRO or .istrusted) and Access 2010 that does check for ENABLE MACRO by using .istrusted.

    I'm in a catch 22. What works for Access 2003 doesn't work for Access 2010 until after I ENABLE MACRO on the Security Bar. I need something that can run BEFOREhand so I know whether or not to display the form (Please select ENABLE MACRO) for the Access 2010 users, or do NOT display the form and go directly to the main menu switch board.

    We have to insure Access 2010 always selects ENABLE MACRO, the .istrusted works great to do that. But .istrusted doesn't work for Access 2003.

    The VBA code (getversionaccess) works great for Access 2003 users, but Access 2010 won't run the VBA code until after the users ENABLE macro which is to late.

    I'm trying to be as clear as possible, but obviously not being very successful. I can't be the only person who's confronted this issues with some users on ACCESS 2003 and ACCESS 2010 at the same time. At least I hope not.

    MacroName Condition Action
    ReTestIsTrusted GetVersionAccess()= 11 RunCode Login()
    .... stopmacro
    Not [currentProject].[istrusted] Msgbox (Select Enable Macro Button)
    .... openform (Enable Macro Required)
    [currentProject].[istrusted] RunCode Login()

    It's the very first line...GetVersionAccess is vba code that does a syscmd to bring back 11.0 for Access 2003. Works great in Access 2003, but Access 2010 won't run the vba function until AFTER enable macro is select which is to late.

    .istrusted is not supported in Access 2003 but is in Access 2010

    I just need some CONDITION that both Access 2003 and Access 2010 can test for that will determine if I'm running Access 2003 or Access 2010, or windows xp or windows 7. If you have Access 2010 here, you also have windows7, and if you have Access 2003 here, you also have xp. So either test will work. Tried to test for a folder that exists in Access 2010 (office14), but the DIR Function doesn't work in Access 2010, but does work in Access 2003.


  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Well you didn't answer the primary question I had. Are you allowed to turn the macro settings all the way down? If you are the simplest way is to set your macro warnings to the lowest possible setting.

    Secondly, you could put the database in a trusted LOCATION, if you do this you won't get the warning but you also have to define that through your trust center:

    Windows icon at the top left > Access Options > Trust Center > Trust Center Settings > Trusted Locations

    This would disable the macro warning for anyone using 2007+ which seems to be the real problem

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access AutoExec Macro Cannot Find Function
    By JuanTooTree in forum Access
    Replies: 10
    Last Post: 06-08-2023, 10:10 AM
  2. Replies: 4
    Last Post: 11-02-2012, 04:39 AM
  3. Replies: 7
    Last Post: 06-14-2012, 01:54 PM
  4. autoexec--currentproject.istrusted
    By Madmax in forum Access
    Replies: 1
    Last Post: 03-06-2012, 06:31 PM
  5. Replies: 2
    Last Post: 06-20-2011, 09:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums