I will by saying I am not a programmer. Back in 2003 Chrissiel sent me this code to get the name of person logging into the database. After all these years, we converted to 64 bit version and this code doesn't work. Can anyone correct the code for me???
Aubrey Price
Chief Pilot
Airborne Imaging
chrissie1 (Programmer)
19 Jan 03 09:27
create a module mile you create a table in the database window
copy this piece of code in the module and save it and close it
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function fOSUserName() 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 = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
now in the defaultvalue you put this fsousername() this will give you the username you use to login to the network (domain)
"What a wonderfull world" - Louis armstrong
Aubrey Price
Chief Pilot
Airborne Imaging
chrissie1 (Programmer)
19 Jan 03 09:27
create a module mile you create a table in the database window
copy this piece of code in the module and save it and close it
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function fOSUserName() 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 = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
now in the defaultvalue you put this fsousername() this will give you the username you use to login to the network (domain)
"What a wonderfull world" - Louis armstrong