Hi,
I have created a user log by adding the users system ID to a table when they log in and deleting when they log out. The code that I used for the user ID is
The insert statement is executed on the on_open event of the startup form and the delete statement on the on_close event of the startup form. This all works great except when
1) the startup is bypassed
2) the database is crashed out of or some other abnormal close occurs
Problem one can be disabled by turning of the AllowBypass property of the database. Any suggestions about what I can do for problem 2 ?
Thanks
Mordja
I have created a user log by adding the users system ID to a table when they log in and deleting when they log out. The code that I used for the user ID is
Code:
This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
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
The insert statement is executed on the on_open event of the startup form and the delete statement on the on_close event of the startup form. This all works great except when
1) the startup is bypassed
2) the database is crashed out of or some other abnormal close occurs
Problem one can be disabled by turning of the AllowBypass property of the database. Any suggestions about what I can do for problem 2 ?
Thanks
Mordja