Sub LogError()
Dim cnn As adodb.Connection
Dim strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "INSERT INTO tblErrorLog ( ErrorDate, ErrorTime, " & _
"UserName, ErrorNum, ErrorString, ModuleName, RoutineName) "
strSQL = strSQL & "Select #" & gtypError.datDateTime & "#, #" _
& gtypError.datDateTime & "#, '" _
& gtypError.strUserName & "', " _
& gtypError.lngErrorNum & ", '" _
& gtypError.strMessage & "', '" _
& gtypError.strModule & "', '" _
& gtypError.strRoutine & "'"
'Execute the SQL statement
cnn.Execute strSQL, , adExecuteNoRecords
End Sub
|