473,406 Members | 2,345 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,406 software developers and data experts.

How can I store the PC %Username%

RobH
56
Access 2003 - I need to be able to capture the PC logon name - so I can see who is making what changes to data.

Any thoughts?
Oct 3 '07 #1
2 13757
MikeTheBike
639 Expert 512MB
Access 2003 - I need to be able to capture the PC logon name - so I can see who is making what changes to data.

Any thoughts?
Hi

This does it for me
Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
  2.                     (ByVal IpBuffer As String, nSize As Long) As Long
  3. Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
  4.                     (ByVal lpBuffer As String, nSize As Long) As Long
  5.  
  6. Function ThisUserName() As String
  7.     Dim LngBufLen As Long
  8.     Dim strUser As String
  9.  
  10.     strUser = String$(15, " ")
  11.     LngBufLen = 15
  12.  
  13.     If GetUserName(strUser, LngBufLen) = 1 Then
  14.         ThisUserName = Left(strUser, LngBufLen - 1)
  15.     Else
  16.         ThisUserName = "Unknown"
  17.     End If
  18. End Function
  19.  
  20. Function ThisComputerID() As String
  21.     Dim LngBufLen As Long
  22.     Dim strUser As String
  23.  
  24.     strUser = String$(15, " ")
  25.     LngBufLen = 15
  26.  
  27.     If GetComputerName(strUser, LngBufLen) = 1 Then
  28.         ThisComputerID = Left(strUser, LngBufLen)
  29.     Else
  30.         ThisComputerID = 0
  31.     End If
  32. End Function
Is that what you had in mind?

MTB
Oct 3 '07 #2
RobH
56
MTB - Thanks I like the option of the Computer ID so it can be tracked to termainal also.
Oct 3 '07 #3

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

Similar topics

4
by: Lobang Trader | last post by:
Hi all, I am trying to create a username and a password class. I would like to know what are the RECOMMENDED minimum and maximum length for both fields? These fields will be something like...
3
by: faktujaa | last post by:
Hi, Currently im storing the connection info. in XML file on the C drive. the only problem with this is that anybody can open and check the database name. I know encryption can solve this problem...
2
by: Peter Rilling | last post by:
How does Windows store passwords that it uses? For instance, when you install a service, you can provide it the username and password. This information is stored somehow so that at a later date...
2
by: Leon | last post by:
Is There a better way I could have written the following stored procedure? Or is my way cool? Checking: Username, Password, Activation = True CREATE PROCEDURE GetAuthorization ( @Username...
0
by: Sid DeLuca | last post by:
I'm modifying the WSE2 HOL sample to develop my web service. I'm able to get the client application's username token encrypted on the way out (outputTrace.webinfo), but not on receipt from the...
0
by: zhenyuandeng | last post by:
Hi, When i call the procedure sp_jysczld_new from the Query Analyzer, it runs slowly. But when i extract the sql scripts from the procedure sp_jysczld_new, it runs quickly. Why? I don't...
11
by: Kevin O'Brien | last post by:
Hello, I am creating a sign on screen for my application in which I want to store the username and password in a database table. I was thinking of putting a combo box connected to the database...
3
by: dorrit.Riemenschneider | last post by:
I need to validate a user with username and password against our OpenLDAP active directory. This is my code: Private bool ValidateUser (string username, string password) { DirectoryEntry...
4
uranuskid
by: uranuskid | last post by:
Hey guys, I need help with following issue: I have a db where userinfos are stored. The script connects to this db in order to check whether the user is logged in. Then I have a from where people...
4
by: madhuriks | last post by:
hi, im new to xml..i developed one application using jsp file..if i enter the values it should store in xml file...for storing using servlet file...the problem is if i enter new values it is not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.