473,378 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Changing tracked user names to something more comprehensible

LeighW
73 64KB
Hi all,

I'm tracking any changes made to records within the database which includes user name and storing it within an archive table (tbl_Archive)

To track the user name I'm using code I managed to find on this site within a form's module which works a treat and is shown below:

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
  2. "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  3.  
  4. Function fOSUserName() As String
  5. ' Returns the login name for Adminstrator use
  6. Dim lngLen As Long, lngX As Long
  7. Dim strUserName As String
  8. strUserName = String$(254, 0)
  9. lngLen = 255
  10. lngX = apiGetUserName(strUserName, lngLen)
  11. If (lngX > 0) Then
  12. fOSUserName = Left$(strUserName, lngLen - 1)
  13. Else
  14. fOSUserName = vbNullString
  15. End If
  16. End Function
What I'd also like to be able to do is change the names given (which as it's a company computer happens to be an incomprehensible set of alphanumerics) to the users actual name so it's easier to understand who made the edit.

As this is going to be a private database with (at present) only a handful of users and the log-on name never changes, I'm guessing there must be a way of changing the names through a module or something.

I tried to create my own like this:

Expand|Select|Wrap|Line Numbers
  1. Public Function UserNames()
  2. LK039384 = "Leigh Woodcock"
  3. End Function
  4.  
And then placed "UserNames" after the code above but it still came up with the jargon rather than my actual name.

Any help would be much appreciated.

Leigh
Oct 3 '12 #1

✓ answered by Rabbit

You should create a user table. Then you can join your archive table to that on the user id to get the user's name. You won't have to edit your code every time a user is added or changed.

3 1493
Rabbit
12,516 Expert Mod 8TB
You should create a user table. Then you can join your archive table to that on the user id to get the user's name. You won't have to edit your code every time a user is added or changed.
Oct 3 '12 #2
LeighW
73 64KB
Of course! I don't know why I didn't think of that. My minds been too wrapped in VBA lately. That way it will be easy to introduce new names without getting into VBA.

Thanks for the help Rabbit
Oct 4 '12 #3
Rabbit
12,516 Expert Mod 8TB
Sure thing. Good luck with your project.
Oct 4 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jason | last post by:
Hi I am busy building the admin part of my ASP.NET application and was just wondering if it is possible to retrieve all user names on the current domain. eg. i am an admin on domain "BEEHIVE"...
1
by: Brian Henry | last post by:
I'm trying to get all the user names of users out of an active directory so they can be put into a database, but when i run the code below it gives nothing back, if i change username to just name...
0
by: Robin Munn | last post by:
I'm developing a simple proof-of-concept Web application, more as a personal programming exercise than anything else, that presents the user with a login form where they can type in a database...
4
by: Jay | last post by:
What's the recommended way to change file/folder names within a project? I want to change the solution name from (say) sol1.sln to sol2.sln, and also everything else named sol1.* (eg sol1.suo,...
2
by: =?Utf-8?B?Q29saW4=?= | last post by:
Both user names on my laptop have vanished from the Windows startup screen. If I try ctrl-alt-del option it wants a password which has never been set. I can't logon as Administrator either. Can I...
4
by: viniiya | last post by:
Hi All, How to Create list of Server/Domains and its User Names from the Network using C#? I tried with Netuserenum and I got only User Names for server but not Domain users. Code I used: ...
4
by: Dan | last post by:
Hi Group Memebers: I am pretty new to asp.net.vb. Please dont mistake me if my Q is silly... I want to list the user names online in home page.... I am adopting this metod: Get the user...
0
by: sh26 | last post by:
I need to be able to add entries to the Windows 'Stored User Names and Passwords' using c# code. Is this possible, if so how can I accomplish this?
1
by: pavla | last post by:
My new Windows 7 computer has 4 user names in the windows task manager. (Pavla, LOCAL SERVICE, SYSTEM, NETWORK SERVICE) Why? can I delete some of these or has someone infiltrated my system? I have a...
0
by: Edmond Azaza | last post by:
I'm a rookie in Computer Science, please help me understand how Windows XP unlike UNIX stores user names and passwords in registry.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.