Var det noget med en rutine som gemmer fejl i en logfil. Så kan brugerne, hvis de bliver udsat for en fejl bare sende logfilen via mail, så du ved hvor du skal starte med evt fejlrettelse:
\'Error Handler errorproc: Select Case Err.Number \'handle known errors here \'Case 999 \'Add procedure to fix error here then \'Resume
Case Else \'Catch All for other errors \'Report error based on the general purpose of the procedure Select Case MsgBox(\"Error loading employee information. \" & _ Trim(Err.Description), vbExclamation + vbRetryCancel + vbDefaultButton1, \"Load Employee Error\") Case vbRetry Resume Case vbCancel \'procedure that logs the error Call LogError(Now, \"Form_Load\", Err, Me, strSomeCommand) End Select End Select End Sub \'Error Logger Public Sub LogError(ByVal ErrDateTime As Date, ByVal ProcName As String, ByRef ErrObj As ErrObject, Optional FormObject As Object, Optional CommandString As String) Dim intFileO As Integer
On Error Resume Next
intFileO = FreeFile(0)
Open App.Path & \"\\Error.log\" For Append As intFileO
If IsMissing(FormObject) And IsMissing(CommandString) Then Write #intFileO, ErrDateTime, ProcName, ErrObj.Description, ErrObj.Source ElseIf Not IsMissing(FormObject) And Not IsMissing(CommandString) Then Write #intFileO, ErrDateTime, ProcName, ErrObj.Description, ErrObj.Source, FormObject.Caption, CommandString \'To enhance this procedure you could add a routine to dump all values found in a form such as: \'Call DumpFormValues(intFileO, FormObject) ElseIf Not IsMissing(CommandString) Then Write #intFileO, ErrDateTime, ProcName, ErrObj.Description, ErrObj.Source, CommandString End If
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.