Results 1 to 4 of 4
  1. #1
    RiskIt is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Aug 2018
    Posts
    20

    Access - Login Form and Store ID/Username

    Hi,

    I have a login form which checks the username (Initials from the table Names) and password. I am looking to store the initials of the person logging in in any way possible to then be displayed in a text box on the form that opens once they have successfully logged in. The end goal is to run a query and use this text box to only show records entered by this users initials.



    Any help is appreciated

    Thanks
    Shane

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Save the login name as a public variable e.g. strUserName.
    Create a function GetUserName in a standard module and set that equal to strUserName.
    On your form, set the textbox value equal to GetUserName.

    Alternatively use a tempvar in much the same way.

    You might want t check out my password login with session logging example app http://www.mendipdatasystems.co.uk/p...gin/4594469149
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Poohbear0471 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    78
    Quote Originally Posted by ridders52 View Post
    Save the login name as a public variable e.g. strUserName.
    Create a function GetUserName in a standard module and set that equal to strUserName.
    On your form, set the textbox value equal to GetUserName.

    Alternatively use a tempvar in much the same way.

    You might want t check out my password login with session logging example app http://www.mendipdatasystems.co.uk/p...gin/4594469149

    Colin,

    Do you have additional documentation on your Password Login example? Specifically, how do I set the Access Level of my objects and can I set password rules? Also, do you have a code example off the GetUserName function? I'd like to add User Initials to the Users table and auto populate those initials into a form field.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by Poohbear0471 View Post
    Colin,

    Do you have additional documentation on your Password Login example? Specifically, how do I set the Access Level of my objects and can I set password rules? Also, do you have a code example off the GetUserName function? I'd like to add User Initials to the Users table and auto populate those initials into a form field.
    Following several requests from various users, I'm in the process of creating a 'pro' version of this app with additional features including the items you requested and more.
    To offset the development time, there will be a small cost. Suggest you email me if interested using the link in my signature line.

    For the GetUserName function, add the following to a standard module.

    Code:
    Public strUserName As StringFunction GetUserName()
    GetUserName=strUserName
    End Function
    Next in your login form, add the following to the login button click event
    Code:
    strUserName=Me.txtUserName
    Finally, add an unbound textbox to the form where you want to display the user name and set its control source to something like
    Code:
    "Hello " & GetUserName()
    HTH
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Store logged in username in a variable
    By Hammilton in forum Forms
    Replies: 11
    Last Post: 12-17-2015, 04:53 PM
  2. Replies: 3
    Last Post: 03-17-2014, 10:23 AM
  3. Username and passwod login using Form
    By Tom1 in forum Programming
    Replies: 4
    Last Post: 07-04-2012, 12:29 PM
  4. Replies: 3
    Last Post: 06-22-2012, 04:19 PM
  5. Recording UserName Login
    By Moonsitter53 in forum Access
    Replies: 1
    Last Post: 03-18-2011, 02:40 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