473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capturing user-id in Access2000

I want to record the user who created a record (and the user who last
changed the record), either initials or a short name

How can I capture a user-id? Can it be done from the user info in the
Windows Registry, or would it involve setting up Security and getting
users to log on to Access?

Any suggestions appreciated
Nov 12 '05 #1
3 1935
Pat
If your users are logging into a Windows domain, you can use this handy API
to retrieve the Windows username.

http://www.mvps.org/access/api/api0008.htm

I've used it with great success.
HTH
Pat
"Alex Marsh" <ve*****@goosemoor.info> wrote in message
news:82**************************@posting.google.c om...
I want to record the user who created a record (and the user who last
changed the record), either initials or a short name

How can I capture a user-id? Can it be done from the user info in the
Windows Registry, or would it involve setting up Security and getting
users to log on to Access?

Any suggestions appreciated

Nov 12 '05 #2
RE/
How can I capture a user-id?


32-bit Windows ID:
-------------------------
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function UserIdWindowsGet() As String
debugStackPush mModuleName & ": UserIdWindowsGet"
On Error GoTo UserIdWindowsGet_err

' PURPOSE: To retrieve the Windows UserID of the person currently logged on to
this PC
' RETURNS: UseID or empty string

Dim myBuffer As String * 255
Dim myUserName As String

GetUserName myBuffer, Len(myBuffer) 'Get the
user name
myUserName = Left(Trim(myBuffer), InStr(myBuffer, Chr(0)) - 1) 'Trim excess
characters

If Len(myUserName) > 0 Then
userIdWindowsGet = myUserName
Else
bugAlert True, "Unable to get Windows UserID"
End If

UserIdWindowsGet_xit:
debugStackPop
On Error Resume Next
Exit Function

UserIdWindowsGet_err:
bugAlert True, ""
Resume UserIdWindowsGet_xit
End Function
--
PeteCresswell
Nov 12 '05 #3
If the Access login id will suffice, enforce at least minimal Access
security so the users have to login and then use the CurrentUser() function
to retrieve the Access login name.

Pat and Pete have already addressed the Windows user name, if that is what
you want.

Larry Linson
Microsoft Access MVP

"Alex Marsh" <ve*****@goosemoor.info> wrote in message
news:82**************************@posting.google.c om...
I want to record the user who created a record (and the user who last
changed the record), either initials or a short name

How can I capture a user-id? Can it be done from the user info in the
Windows Registry, or would it involve setting up Security and getting
users to log on to Access?

Any suggestions appreciated

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
6
by: Robert Nurse | last post by:
Hi, Is it at all possible to capture and suppress the backspace key when focus is not on a form edit control? Basically, while the page is loading I don't want the user pressing the backspace...
4
by: Jay Xx | last post by:
I have an IFrame in design mode. I've tried a bunch of things to capture key presses in that IFrame, but I can't seem to get it. I can capture key presses outside the IFrame fine. I have this...
33
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if...
1
by: Jonah Olsson | last post by:
Hello, I'm trying to build an "add-on" to an already existing custom web user control. The old control collects some user data and saves it to a database. The new control should collect some...
2
by: Stampede | last post by:
Hi guys & girls, I would like to write some kind of "Head-Tracking-Software", which uses a WebCam to react to the movement of the head of the person sitting in front of the monitor. I searched...
2
by: GS | last post by:
How can one avoid capturing leading empty or blank lines? the data I deal with look like this "will be paid on the dates you specified. xyz supplier amount: $100.52 when: September 07,...
4
by: browser newbie | last post by:
Hello How can I capture the link a user clicks on ? After capturing will I be able to form the HTTP request so that I can change the server its going to? For example...if the URI in the page...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.