Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting log names

Status
Not open for further replies.

jofet

MIS
Sep 3, 1999
32
PH
is there a way to get the name of the pc (windows network login name) in a network that modified a certain record and put it in a table for reference?

thanks :) [sig][/sig]
 
Yes, the network login name can be extracted and then stored in a field by using the advapi32.dll in a function. The function would look something like this:-
++++++++++++++
Private Declare Function apiGetLoginName Lib "advapi32.dll" Alias _
"GetLoginName" (ByVal lpBuffer As String, nSize As Long) As Long
+++++++++++++++
Function FGetName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetLoginName(strUserName, lngLen)
If lngX <> 0 Then
FGetName = Left$(strUserName, lngLen - 1)
Else
FGetName = &quot;&quot;
End If
++++++
'here you can add the code to save the value of FGetName into the table
++++++
End Function

Enjoy .... ;-)


Vandys [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top