Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2004
    Posts
    15

    Unanswered: Access ID and Password

    Help. I want my access database to track who made changes to data. In order to do that, access needs to know who is logged on. Right now, when I update a field with the current user, it just says "admin". I figure that I need a user ID (and password) assigned to each user, but the regular Access security functionality is not an option for me. I'm in a big company, and everyone is using other databases all over the place. If I add someone to a user group, it would mess up their access to other databases. I don't need any user level security, I just want Access to know who is logged on by recording a variable (UserID) when they start up the database and enter their ID and password. Any hints?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You can use the Environ() function to grab who is logged into the PC if that works for you.
    Paul

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    personally I dont trust environ settings, I'd always go back to the api calls. Having used environ for a while a colleague pointed out how easy they are to spoof, or corrupt, and that you cannot always rely on them being there (it depends on available memory at boot time, or if and when they connect to he network.

    The API call to me seems preferable.

    Environ is great for finding things direcetories, temp work areas etc... but not for something that you have to trust or rely on
    Last edited by healdem; 11-13-06 at 11:35.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Finding user LoginID

    Here's a snippet I've been using which works quite well and I've posted a number of times on this board. See if it works ok for you.

    (Note: You need the class modules so don't forget to import those if you're importing the code.) You can set the default of your ModifiedBy or EnteredBy field (or whatever it's called) to =getuser(). This will set the default value to the user's loginID. You can also use =getuser() anywhere in a query, function, etc..
    Attached Files Attached Files
    Last edited by pkstormy; 11-13-06 at 11:32.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Cloning db

    Also,

    Here's another technique I use which works for a split database (i.e. frontend cloning) or an mdb/mde with SQL Server backend tables linked into it. It basically clones the frontend mdb/mde with the user's login name and opens the new mdb/mde file with the user's login name. This allows you to copy new code without having users exit out of the base mdb/mde and also allows you to see who's in the mdb/mde by looking at the folder for ldb file (which will have the user's login name attached.) Again, it only works for the frontend - (i.e. don't do it on an mdb/mde with MSAccess tables or each user will be working on their own set of MSAccess tables).

    You'll need to modify the UNC path in the vbs script (use notepad and save it as a vbs script). Ignore all the comments as these are items I didn't get rid of.

    Just copy the modified vbs script to the same folder as your mdb/mde file and create a shortcut on the user's desktop to the vbs script.

    P.S. Thanks to Dan Wang for help on the script.
    Attached Files Attached Files
    Last edited by pkstormy; 11-13-06 at 11:43.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Sep 2004
    Posts
    15
    That works! Thanks!

Posting Permissions

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