You are here:

Using MS Access/Access 2013 Tracking Usernames

Advertisement


Question
Scott,
I have read your article on Creating Login Security using VBA code.
I am new to Access and am trying to set up a database for the local food shelf.  
I have the user login Screen and Usser_table set and that is working fine.
Now I just want to capture the username and date for each change when the user adds or changes a record in the form.
I tried code that uses Environ("UserName") but that provides only the global login.  I wish to use the login username that was created for the login form in your example.
I would appreciate any help you can provide.
Thank you, Ann

Answer
Hi Ann,

If you followed my example, then you should be hiding the Login form (Visible = False) once the user has been authenticated. By hiding the form you can reference the value wherever you want.

In the Before Update event of your form you can use:

Me.EditedBy = Forms!frmLogin!cboUser

to assign the userID to the control.  

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.