none
Environ is now an undefined function

    Question

  • I have been using [Environ$]("computername") in a query in access 2003 for many months.  The Access database is shared by several users and I use this to match up each computer user with a set of records that are theirs.  When I cam in this morning I was told there was an issue and this error is shown: undefined function "[environ$]' in expression.  This database usually sits in a shared folder on a microsoft server 2003 sbs.  Can anyone help me solve this issue?

    Cameron

    Tuesday, August 02, 2011 6:48 PM

Answers

  • I have solved the problem.  There was  a new pc installed and all the access 2003 updates were completed on it.  Under Tools | Macro | Security, the settings for macro's was set to medium which apprently disables or somehow removes the Environ function or ability of the Environ function to run in any database that is opened by that computer.  I set the macro to low and it no longer screws up my database's.  I would like to know if there is a way to re-enable what ever is being disabled or removed to stop the Environ function from running, but at least I have solver the issue.

    Thanks for the help. Cameron 

    Thursday, August 04, 2011 1:03 PM

All replies

  • Check Tools | References... in the Visual Basic Editor and look for selected references beginning with MISSING:

     

    (This could happen if someone opens the database in Access 2007 or 2010; it'd be better to give each user an individual copy of the frontend and to keep the tables in a shared backend on the server)


    Regards, Hans Vogelaar
    Tuesday, August 02, 2011 6:53 PM
  • Hans, thanks for the quick response.  I have found no missing references and I also compared the db to one that is working and all the same references are checkmarked. 

    Tuesday, August 02, 2011 7:03 PM
  • In that case, you're probably running into restrictions imposed by Sandbox Mode. See http://support.microsoft.com/kb/294698/en-us for an explanation and how to circumvent it.


    Regards, Hans Vogelaar
    Tuesday, August 02, 2011 7:20 PM
  • I will read through the information.  But how can one database work fine and the other have the missing reference error if it a Sandbox issue?  The database that works is a backup copy of the one with the issue.  And I am opening both databases on the same pc.
    Tuesday, August 02, 2011 7:59 PM
  • That is strange indeed - I have no explanation for that, sorry.


    Regards, Hans Vogelaar
    Tuesday, August 02, 2011 8:30 PM
  • Have you tried to repair MS Office/Access? It could be the problem.

    or

    it need to be compact and repair.

    PS. If it still didn't work, try this function instead from Dev Ashish.
    http://access.mvps.org/access/api/api0009.htm

    I did remember that there was a debate to avoid using Environ function long time ago. Something about security and will be outdated in newer OS.

    Wednesday, August 03, 2011 1:56 AM
  • Users can easily change the value returned by Environ("username"). But the question remains why works for the OP in one version of a database and not in another version.
    Regards, Hans Vogelaar
    Wednesday, August 03, 2011 5:31 AM
  • I will look into this suggestion, however I would have to figure out how to make this suggestion work within a Query in the same manner Environ is being used. 
    Wednesday, August 03, 2011 12:12 PM
  • I have solved the problem.  There was  a new pc installed and all the access 2003 updates were completed on it.  Under Tools | Macro | Security, the settings for macro's was set to medium which apprently disables or somehow removes the Environ function or ability of the Environ function to run in any database that is opened by that computer.  I set the macro to low and it no longer screws up my database's.  I would like to know if there is a way to re-enable what ever is being disabled or removed to stop the Environ function from running, but at least I have solver the issue.

    Thanks for the help. Cameron 

    Thursday, August 04, 2011 1:03 PM
  • Hans Vogelaar [MVP] wrote:

    Users can easily change the value returned by Environ("username").

    Not in Windows 7. 
    Tony


    Tony Toews, Microsoft Access MVP
    Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
    Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
    For a convenient utility to keep your users FEs and other files   updated see http://www.autofeupdater.com/

    Sunday, August 07, 2011 11:08 PM
  • Tony Toews - Access MVP <tony@granite.ab.ca> wrote:

    Users can easily change the value returned by Environ("username").

    Not in Windows 7. 

    I should rephrase that.  Users can change that variable in Windows 7.
    Just that Access VBA ignores the change.

    Tony


    Tony Toews, Microsoft Access MVP
    Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
    Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
    For a convenient utility to keep your users FEs and other files   updated see http://www.autofeupdater.com/

    Sunday, August 07, 2011 11:09 PM
  • Tony Toews - Access MVP <tony@granite.ab.ca> wrote:

    Users can easily change the value returned by Environ("username").

    Not in Windows 7. 

    I should rephrase that.  Users can change that variable in Windows 7.
    Just that Access VBA ignores the change.


    Thanks! I didn't know that.
    Regards, Hans Vogelaar
    Sunday, August 07, 2011 11:45 PM