Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2003
    Posts
    45

    Unanswered: Change Current User Logon

    How can I change current username in my Access Project using my owne designed login form?

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Beats me... but why would you want to do this?

    If you have your own login form, you already have the username. You just need to code your required security into your form and report objects.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Oct 2003
    Posts
    45
    I don't like to use Access Default system MDW file, I like the user to login to my project using specific login form that check users name and their related passwords, the problem is that within the project other tables should store current user of the database and it usually Admin (System Default) how can I change the current UserName to the one entered using my own login form?

  4. #4
    Join Date
    Sep 2007
    Location
    Global Village
    Posts
    185
    Why you want to change the user name when you can change your code to put your own login name in the related tables?!

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so you wantr to logon and use current user

    aside form saying don't... you'll otentially open up a huge can of worms...

    you can logon to an Access instance by joining a workgroup, definign userids & passwords there

    have a google on Access security and Access workgroups

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Check out this example: Keep in an open mind when you look at it as it shows you a different way you can set up your security which I use in a lot of programs. But it also let's you change to another user login applying the security that user login has so you can "mimick" seeing what they see.

    http://www.dbforums.com/showpost.php...9&postcount=68
    Last edited by pkstormy; 04-22-08 at 05:28.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Oct 2003
    Posts
    45
    Thanks pkstormy,
    I'm allready had done the same of your demo, now I have one table called "USERS" contains users info, login name and password, I have another table Called "Items_List", it contain a field "User_Stamp" to keep in tarck when & who updated the record which is the user login name, how can I insert the login name to that field?

  8. #8
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    For new records, set the default value of User_Stamp to =getuser() where getuser() returns the windows loginID and is found in the demo I had.

    For existing records, I would recommend adding a 2nd UpdatedBy field to that table and then on form for that field, populate it with getuser() in the AfterUpdate event (as well as a DateUpdated field)

    The 4 fields I have to track information in key data tables are:
    DateEntered (defaults to today's date)
    EnteredBy (defaults to getuser())
    DateUpdated (populated with date once record is updated) i.e. me!DateUpdated = date() which is run in the AfterUpdate event of the form.
    UpdatedBy (populated with getuser() once record is updated) i.e. me!UpdatedBy = getuser() which is run in the AfterUpdate event of the form.

    If you're updating to another table (other than the open form), keep in mind that getuser() can be used as an expression in any query to update a field or in a module/function. If that's the only field you're updating (and I don't know the details on how your updating it) but you may need to write some code to open a recordset to the exact record you want to update and use getuser() to update the field.

    I hope that helps.

    If you're trying to do something else, I apologize but I don't understand.
    Last edited by pkstormy; 04-22-08 at 09:18.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  9. #9
    Join Date
    Oct 2003
    Posts
    45
    Thanks alot you have done the best.

Posting Permissions

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