Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2015
    Posts
    3

    Unanswered: Recognize users who log in and update fields accordingly

    Hi All,

    I'm new to this website, but not that entirely new to Microsoft Access. I've been lurking for the last few months. I've been looking over the web and this forum to solve a problem and I can't seem to figure out a solution.

    I currently have a basic login form thanks to http://www.databasedev.co.uk/login.html (if posting outside links is not recommended, I can paste the code. I was given this code from another thread I've seen on here).

    I've only slightly modified that code to include a case statement (different users will have access to specific forms).

    My problem is this. I want to have a field in each form update whenever that user makes an adjustment to one of the fields.

    I'll use 3 fields in this example.

    1-"status" field: This field has a basic drop-down list of things a user can select from.
    2-"status updated" field: Whenever the status field is changed, this field is =now() in the before update action. This way I know when the status was updated. So far it works just fine for my use.
    3-"status updated by" field: here is my problem. I want this field to now update to the user who is logged in from the login form posted above. In this case, I have all userID's as initials, so that is what I want posted when the "status" field is changed.

    How do I make it so each form can recognize when someone logs in? Is there a way I can somehow create a global variable and then say something like "if status field changes, set value of status updated by = userid"? I'm not fluent enough in VBA to handle this.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why create a user variable, instead why not use the users network logon ID?
    the only time its not set is when there has been a newtwork glitch, and that isn't going to be an issue if your application is referring to a remote data store.
    google 'dev ashis api call' for details. the same API refewrences will also tell you how to identiofy what computer the user used as well. imn a careful;ly designed applciation that gives you enough information to stack legally in disciplianry or external legal matters.

    effectivley the network API call is a function which returns the user id.
    no need to write logon
    no need to test or maintain the code (after ntiail proof)

    better yet no need to keep ahead of security advisories, forces users to maintian differnt logons write your own code. its available

    yes the environ function probably gives the same value as the API call, for all I know it may be a wrapper around the API call but ive seen environ spoofed and or borked once to often to rely on it for anything.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2015
    Posts
    3
    Quote Originally Posted by healdem View Post
    why create a user variable, instead why not use the users network logon ID?
    the only time its not set is when there has been a newtwork glitch, and that isn't going to be an issue if your application is referring to a remote data store.
    google 'dev ashis api call' for details. the same API refewrences will also tell you how to identiofy what computer the user used as well. imn a careful;ly designed applciation that gives you enough information to stack legally in disciplianry or external legal matters.

    effectivley the network API call is a function which returns the user id.
    no need to write logon
    no need to test or maintain the code (after ntiail proof)

    better yet no need to keep ahead of security advisories, forces users to maintian differnt logons write your own code. its available

    yes the environ function probably gives the same value as the API call, for all I know it may be a wrapper around the API call but ive seen environ spoofed and or borked once to often to rely on it for anything.
    I'm going to look into this at work tomorrow. I was just asked to do this stretch assignment (knowing this is not why I was hired), so I really am not a professional at this.

    Is what you're referring to pretty technical stuff? I just need something easy to set up and practical. Security really isn't an issue, because the data isn't confidential nor will many users be working with this each day.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    its no more technical than what you have already done (copy and past code, following instructions form a web page).
    to get the userid you call a function

    there is less code to maintain, less code to deal with.
    but BEST of all its the users logon that youget, not the userid the user put into open up Access. So assuming your netwrok security policies are locked down to only on logoin on active at any one time, you know the network logon is that person. unless their userid and password has been compromised then you know who that user is. you don't have to check in Access if there is already another user of that code.
    you don't have to create user accounts within Access, not do you have to write a password maintenance form.

    depending on the version of Access and if/how you want to tie down security you may have to add the netwrok logon to your wiorkgroup file and assign permissions but you'd have to do that for an Access password.

    users can't spoof the network logon. they can't take a sneak look at someone else's access logon (say at yours whilst you do a demo) and then impersonate that logon afterwards.

    if you want to create an audit trail you cna al,so record the computer ID. Allen browne's site is an escellent resource for an audit trail.

    if you need to restrict visibility of data then you have several options
    one is only show data that user created (or owns by applying the filter to any relevant quer which restricts the data appropriately (no table changes)
    if you need to allow some sort of structure then you may well need a table(s) which identify which users can view which other users data.. but that is startigfn to get more technical, but it will be just as 'technical' as your logon from as it will require similar steps there as well.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jan 2015
    Posts
    3
    You were very helpful!!!! All I needed was the =fOSUserName and it works like a charm!!! I'm very happy with this so far. Thank you very much.

Posting Permissions

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