Results 1 to 3 of 3
  1. #1
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92

    Windows Username Authentication

    Hello all!




    I have run into an issue that has me puzzled.


    At my workplace, we have an access database that is sent out periodically to all of the employees. In order to access it, each employee has to log in to their own Windows username and pull the file from a shared network drive. In the database, there is a button that says "click here". Once clicked, it displays information that is specifically tied to the logged in user. There are 1000's of employees and only one file, so it is somehow using the username of the logged in person to display records. The file is an executable, so I can not reverse engineer it.


    Does anyone have any idea how I can create something similar? I can not seem to find any mention of such a setup at all online.


    Thank you for any help that you can provide!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    One way to get the Windows username is with:

    Environ("USERNAME") - yes, type it exactly like that

    How the form or report filters records depends on how the user identification is managed. If the Windows username is stored in the record in a field called [user] then:

    DoCmd.OpenForm "formname", , , "[user]='" & Environ("USERNAME") & "'"

    If the record instead stores another identifier for the employee, such as EmpID (e.g. 6789), then need a table of Employees with fields for the EmpID and UserName. Code will do a lookup on the Windows username and retrieve the EmpID to filter form or report:

    DoCmd.OpenForm "formname", , , "[EmpID]=" & DLookup("EmpID", "Employees", "Username='" & Environ("USERNAME") & "'")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    james28 is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    92
    June,

    Thank you very much for the reply. That was exactly what I needed!



    Take care!

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

Similar Threads

  1. Replies: 14
    Last Post: 08-17-2015, 02:32 AM
  2. Replies: 0
    Last Post: 03-12-2014, 01:03 PM
  3. Windows Log In "Username" in an append query
    By jlgray0127 in forum Queries
    Replies: 1
    Last Post: 02-26-2013, 09:46 AM
  4. Password Authentication
    By jmjbear in forum Programming
    Replies: 8
    Last Post: 11-27-2011, 02:12 PM
  5. Replies: 3
    Last Post: 07-15-2010, 05:53 PM

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