RE:como obtener el id del usuario o id de la Pc co
Coloca esto en un modulo:
Declare Function wu_GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Declare Function wu_GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function ap_GetComputerName() As Variant
Dim strComputerName As String
Dim lngLength As Long
Dim lngResult As Long
'-- Establecer el buffer
strComputerName = String$(255, 0)
lngLength = 255
'-- Realiza la llamada
lngResult = wu_GetComputerName(strComputerName, lngLength)
'-- Asignar el valor
ap_GetComputerName = Left(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
End Function
Function ap_GetUserName() As Variant
Dim strUserName As String
Dim lngLength As Long
Dim lngResult As Long
'-- Establecer el buffer
strUserName = String$(255, 0)
lngLength = 255
'-- realiza la llamada
lngResult = wu_GetUserName(strUserName, lngLength)
'-- asignar valor
ap_GetUserName = strUserName
End Function
' y esto donde quieres colocarlo
' Me.Usuario = "Usuario Red : " & UCase(ap_GetUserName())
' Me.Etiqueta51 = "Nombre Equipo : " & UCase(ap_GetComputerName())