Results 1 to 5 of 5

Thread: LogIn

  1. #1
    Join Date
    Jan 2010

    Unanswered: LogIn

    I have a login form unbound to a table. The user will enter employee ID and password and through DLookup it will look up the users ID through a table called Employees and then look for the password. I also have another form, ErrorLog, that is bound to a table titled Error Log. I have a textbox, LoggedBy, on that form that I would like populated with whomever is logging in. Is there a way to do this?

  2. #2
    Join Date
    Jan 2010
    This is the code that I have on a few of my databases. In the BeforeUpdate, add this Code in VBA:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me!Loggedby = CurrentUser()
    End Sub

    I hope this is what you are looking for.

  3. #3
    Join Date
    May 2005
    Agree with Sangie in that I try to avoid having the user login manually: it's annoying for the user to do so everytime they launch it, not to mention making them have to remember and maintain yet one more password at work, it's annoying for me the developer to store this temp variable somewhere, and it's not the most secure approach (not that I can say that anything in Access is secure, per se, but some things are better than nothing).

    I avoid CurrentUser though. Use Dev Ashish's fOSUserName function instead. If you need help on this function, check out this tutorial.

    HTH. Cheers!
    Me.Geek = True

  4. #4
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    You can simply hide rather than close the login form when the user successfully logs in. That way the user is accessible via:


  5. #5
    Join Date
    Dec 2004
    Madison, WI
    If you're interested, here's an example of a login/permission type setup. It automatically recognizes the user's loginID (to windows - no need for the user to login), matches this against a user table, if not found, prompts the user for their loginID and assigns them basic level permissions, and demonstrates code to hide/enable/disable buttons (such as admin or other buttons) on a form based on the user's security level (it's very basic coding with 1 or 2 lines of code on the form):
    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