CurrentUser with Access Project

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

I have recently 'upsized' my Access DB to SQL server and
Access project. Doing this removes the Jetadmin security
stuff, so the .mdw is no longer used.

Could someone please tell me how (or where to look) to
find out who the user is that is currently using the DB.

Now that Jetadmin security is no longer being used
CurrentUser() is returning "Admin" regardles of who the
user is (just like the book says...).

Thanks!!
Sean
 
Create a module with the following code:

Option Compare Database
Public pstrUserName As String
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nsize As Long) As Long

Public Function GetUserID(strUserParam As String)
Dim buffer As String * 512, length As Long, X As Integer
NSCEntered = 0

If GetUserName(buffer, Len(buffer)) Then
length = InStr(buffer, vbNullChar) - 1
strUserParam = Left$(buffer, length)
Else
X = MsgBox("Error 1 - User ID could not be validated", vbOKOnly)
DoCmd.Quit
End If
End Function

Call the function to get the Network ID. This is not original work by me. I
copied the code from one of the sites on the Internet but can't remmember
which one or I would certainly give the appropriate credit.
 
ZZZOW! Things went from simple to complicated real
quick... Thank You so much for the help and quick reply!!

Sean
 
Back
Top