Thanks in advance! I have an un-secured database that I can see which
computer name is logged-on but not the user. I have an error module
that can get the user name. It writes to an error file.
What I'd like to do is to have an invisible error generated that would
post to this log, but do nothing else. Any ideas?
My error log works like this:
Call LogErr
'this calls my module named: modErrorLog:
Option Compare Database
Option Explicit
Public Sub LogErr(ByVal strEvent As String, ByVal strForm As String, _
ByVal bolShowMsg As Boolean)
Dim cnn As New ADODB.Connection
Dim rec As New ADODB.Recordset
Dim strSQL As String
Dim strUser As String
Dim strPC As String
Dim lngNum As Long
Dim objAPI As New clsAPI
With objAPI
strPC = .ComputerName
strUser = .UserName
End With
Set cnn = CurrentProject.Connection
cnn.CursorLocation = adUseClient
strSQL = "SELECT * FROM tblErrors"
rec.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
Debug.Print rec.Supports(adAddNew)
With rec
.AddNew
.Fields("UserName").Value = strUser
.Fields("ComputerName").Value = strPC
.Update
End With
rec.Close
cnn.Close
Set cnn = Nothing
Set objAPI = Nothing
End Sub