I have recently changed the structure of my table to not allow duplicates, using a combined primary key.
So in one respect i am happy now to stop the duplication, but how can i change the error message so it is more user friendly.
Access front End - with Error Logging - but it does not log this error.
SQL server back end.
So in one respect i am happy now to stop the duplication, but how can i change the error message so it is more user friendly.
Access front End - with Error Logging - but it does not log this error.
SQL server back end.
Code:
Function LogError(ByVal iErrNumber As Integer, ByVal strErrDescription As String, strCallingProc As String, Job_ID As String)
On Error GoTo Err_LogError
' Purpose: Generic error handler.
' Logs errors to table "tLogError".
' Arguments: iErrNumber - value of Err
' strErrDescription - value of Error$
' strCallingProc - name of sub|function that generated the error.
' Author: Allen Browne, allen@allenbrowne.com, June 1997.
Dim NL As String * 2 ' New Line
Dim sMsg As String ' String for display in MsgBox
Dim db As Database ' Current database
Dim rst As Recordset ' The tLogError table
Dim Strql As String
'Waitoff
sMsg = "Error " & iErrNumber & ": " & strErrDescription
If iErrNumber = 6 Then
MsgBox "Please contact Gareth Tucker giving brief description of what you were doing when you received the error!"
End If
'If iErrNumber <> 3167 Or iErrNumber <> 1004 Then
' MsgBox sMsg, 32, strCallingProc
'End If
If iErrNumber = 2114 Then
Else
MsgBox sMsg, 32, strCallingProc
End If
''''''debug.print Err.Number
Set db = CurrentDb()
'Set Query = CurrentDb.QueryDefs("QryQCLogError")
Set Query = CurrentDb.QueryDefs("QryQCLogError")
Set rst = Query.OpenRecordset(dbOpenDynaset, dbSeeChanges)
rst.AddNew
rst![ErrNumber] = iErrNumber
rst![ErrDescription] = Left$(strErrDescription, 255)
rst![ErrDate] = Now
rst![CallingProc] = strCallingProc
rst![UserName] = GetLongName
rst![Parameters] = Job_ID
rst.Update
rst.Close
'End If
Exit_LogError:
Exit Function
Err_LogError:
If iErrNumber = 6 Then
MsgBox "Please contact Admin giving brief description of what you were doing when you received the error!"
End If
sMsg = "An unexpected sitPRODion arose in your program." & NL
sMsg = sMsg & "Please write down the following details:" & NL & NL
sMsg = sMsg & "Calling Proc: " & strCallingProc & NL
sMsg = sMsg & "Error Number " & iErrNumber & NL & strErrDescription & NL & NL
sMsg = sMsg & "Unable to record because Error " & Err & NL & Error$
MsgBox sMsg, 16, "LogError()"
Resume Exit_LogError
End Function