Thank you George.
I tried your suggestion but I still can not get it to work.
Do i need to do something else? I copied the following into my code.
Option Compare Database
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
I copied the code into a sub as below.
'****Begin sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
On Error GoTo BeforeUpdate_Err
strUserName = String$(20, 0)
lngLen = 100
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
UserModified = Left$(strUserName, lngLen - 1)
Else
UserModified = vbNullString
End If
' Set bound controls to system date and time.
DateModified = Date
TimeModified = Time()
BeforeUpdate_End:
Exit Sub
BeforeUpdate_Err:
MsgBox Err.Description, vbCritical & vbOKOnly, _
"Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
'****End sub
Thanks