Christopherusly
Village Idiot.
- Local time
- Today, 21:02
- Joined
- Jan 16, 2005
- Messages
- 81
When using the modUSER and modCNAME to display the current logged in user and machine name, how would i go about writing this to a table when a record is created ?
This is a great little bit of code which is fantastically useful, if only i were able to record the instance of the user creating records, which would not require the user to actually provide their name ( dishonest bunch that they are
)
Any suggestions, or pointers in the right direction are most welcome
Many thanks
The code looks like:
and
This is a great little bit of code which is fantastically useful, if only i were able to record the instance of the user creating records, which would not require the user to actually provide their name ( dishonest bunch that they are
Any suggestions, or pointers in the right direction are most welcome
The code looks like:
Option Compare Database
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
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 = ""
End If
End Function
and
Option Compare Database
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSMachineName() As String
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function