Years ago, I got a nifty piece of code from someone on this forum that pulls a user's logon name from the network, so that I can stamp that name on the user's work. It works great in our office, but any time I have to develop a database for a client to use in their office, it doesn't work. I don't know what this code means, just that it works for us--so I don't know how to troubleshoot or adapt.
I don't want to use Access workgroup security on a database that I won't be present to administer.
Here's the code:
Declare Function wu_WNetGetUser Lib "advapi32.dll" Alias "GetUserNameA" (ByVal sUser As String, nBuffer As Long) As Long
Function NetWareCurUser() As String
Dim sUser As String
Dim nBu As Long
Dim X As Variant
nBu = 8
sUser = Space(nBu)
X = wu_WNetGetUser(sUser, nBu)
sUser = Left(sUser, nBu - 1)
If IsNull(sUser) Then
MsgBox "Incorrect logon"
Else
NetWareCurUser = sUser
End If
End Function
Our server is NT 4.0. What should I know about the client's network in order to adapt this routine to their environment? Or is there another approach I could try? I've reviewed posts in this forum but didn't find anything that quite addresses my question.
I'm using Access 2003.
I don't want to use Access workgroup security on a database that I won't be present to administer.
Here's the code:
Declare Function wu_WNetGetUser Lib "advapi32.dll" Alias "GetUserNameA" (ByVal sUser As String, nBuffer As Long) As Long
Function NetWareCurUser() As String
Dim sUser As String
Dim nBu As Long
Dim X As Variant
nBu = 8
sUser = Space(nBu)
X = wu_WNetGetUser(sUser, nBu)
sUser = Left(sUser, nBu - 1)
If IsNull(sUser) Then
MsgBox "Incorrect logon"
Else
NetWareCurUser = sUser
End If
End Function
Our server is NT 4.0. What should I know about the client's network in order to adapt this routine to their environment? Or is there another approach I could try? I've reviewed posts in this forum but didn't find anything that quite addresses my question.
I'm using Access 2003.