By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,324 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,324 IT Pros & Developers. It's quick & easy.

Capturing user-id in Access2000

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.