diff options
Diffstat (limited to 'wizards/source/access2base/Trace.xba')
-rw-r--r-- | wizards/source/access2base/Trace.xba | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/wizards/source/access2base/Trace.xba b/wizards/source/access2base/Trace.xba index c7bb7a47cbd4..220f1f623e5a 100644 --- a/wizards/source/access2base/Trace.xba +++ b/wizards/source/access2base/Trace.xba @@ -8,7 +8,7 @@ REM ============================================================================ Option Explicit -Public Const cstLogMaxEntries = 20 +Public Const cstLogMaxEntries = 99 REM Typical Usage REM TraceLog("INFO", "The OK button was pressed") @@ -163,8 +163,10 @@ Dim sErrorText As String, sErrorDesc As String, oDb As Object & Iif(psErrorProc <> "", " " & _GetLabel("ERRIN") & " " & psErrorProc, Iif(_A2B_.CalledSub = "", "", " " & _Getlabel("ERRIN") & " " & _A2B_.CalledSub)) With _A2B_ .LastErrorCode = piErrorCode + .LastErrorLevel = psErrorLevel .ErrorText = sErrorDesc .ErrorLongText = sErrorText + .CalledSub = "" End With If IsMissing(pvMsgBox) Then pvMsgBox = ( psErrorLevel = TRACEERRORS Or psErrorLevel = TRACEFATAL Or psErrorLevel = TRACEABORT ) TraceLog(psErrorLevel, sErrorText, pvMsgBox) @@ -172,7 +174,7 @@ Dim sErrorText As String, sErrorDesc As String, oDb As Object ' Unexpected error detected in user program or in Access2Base If psErrorLevel = TRACEFATAL Or psErrorLevel = TRACEABORT Then If psErrorLevel = TRACEFATAL Then - Set oDb = Application.CurrentDb() + Set oDb = _A2B_.CurrentDb() If Not IsNull(oDb) Then oDb.CloseAllrecordsets() End If Stop @@ -181,18 +183,21 @@ Dim sErrorText As String, sErrorDesc As String, oDb As Object End Sub ' TraceError V0.9.5 REM ----------------------------------------------------------------------------------------------------------------------- -Public Function TraceErrorCode(ByVal Optional piMode As Integer) As Variant -' Return the last encountered error code or description +Public Function TraceErrorCode() As Variant +' Return the last encountered error code, level, description in an array ' UNPUBLISHED -Const cstCode = 0, cstDesc = 1, cstLongDesc = 2 +Dim vError As Variant - If IsMissing(piMode) Then piMode = cstCode - Select Case piMode - Case cstCode : TraceErrorCode = _A2B_.LastErrorCode - Case cstDesc : TraceErrorCode = _A2B_.ErrorText - Case cstLongDesc : TraceErrorCode = _A2B_.ErrorLongText - End Select + With _A2B_ + vError = Array( _ + .LastErrorCode _ + , .LastErrorLevel _ + , .ErrorText _ + , .ErrorLongText _ + ) + End With + TraceErrorCode = vError End Function ' TraceErrorCode V6.3 |