Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: Environ("username") is not working in office 2003

    Hello, we have a field call user =Environ("username")

    this works fine on office 2000. Now we just update office to office 2003.
    However, this worked fine before, but I have now it is not working anymore.
    Please help.

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Try Environ(28). It's the same thing.

    Sam

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    nope not neccesarily
    you cannot guarantee that a numeric index will retrieve the same value as the string index.

    you cannot rely on environ to return anything.. it depends entirely on what is set at the time the logon script runs, what memory is available.

    it is precisely for this sort of reason you shouldn't rely on environ to return anything critical to the application, well that and also because it is oh so easy to spoof.

    try Dev Ashish's API call or the functions by PKStormy on this site.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    For PKStormy's method - look here: http://www.dbforums.com/showpost.php...0&postcount=20
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Mar 2004
    Posts
    660
    I think the office 2003 block this function because of the security. I will try to write a code that you provided. Thank you all.

  6. #6
    Join Date
    Mar 2004
    Posts
    660
    Thanks. It is great. It works now. Thanks again.

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Here also is some vb script code:

    Set WshNetwork = CreateObject("WScript.Network")
    GetUser = WshNetwork.UserName
    Set WshNetwork = Nothing

    retval = msgbox ("User Name is: " & GetUser)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •