IN THE SPOTLIGHT: MDE to MDB Conversion Service
(also supports: ACCDE to ACCDB, ADE to ADP, etc)
IN THE SPOTLIGHT: Access Database Repair Service
An in-depth repair service for corrupt Microsoft Access files
IN THE SPOTLIGHT: vbWatchdog
VBA error handling just got easier...
" vbWatchdog is off the chart. It solves a long standing problem of how to consolidate error handling into one global location and avoid repetitious code within applications. "
- Joe Anderson,
Microsoft Access MVP
Meet Shady, the vbWatchdog mascot watching over your VBA code →
(courtesy of Crystal Long, Microsoft Access MVP)
IN THE SPOTLIGHT: vbMAPI
An Outlook / MAPI code library for VBA, .NET and C# projects
Get emails out to your customers reliably, and without hassle, every single time.
Use vbMAPI alongside Microsoft Outlook to add professional emailing capabilities to your projects.
IN THE SPOTLIGHT: Code Protector
Standard compilation to MDE/ACCDE format is flawed and reversible.
The information below applies only to the VBA edition of the global error handler (SimplyVBA Global Error Handler)
To demonstrate how to enable and disable the SimplyVBA Global Error Handler, let's create a simple example application. We will add a global error handler to your application that simply logs all errors that occur to a text file.
With your Access database application open, launch the VBA IDE by pressing Ctrl+G. Go to the Tools >> References... menu option.
(Alternatively, you can go do this with the Add-Ins >> SimplyVBA Global Error Handler >> Setup normal COM library DLL support option)
Put a tick next to the 'SimplyVBA Global Error Handler Library' (as above).
Press OK.
Public Function EnableErrorHandler() If ErrEx.EnableGlobalErrorHandler(Access.Application, "MyGlobalErrorHandler") = False Then MsgBox "EnableErrorHandler() failed. Failed to activate the global error handler." End If End Function Public Function DisableErrorHandler() ErrEx.DisableGlobalErrorHandler End FunctionInfo: You will notice that we have declared these two routines as Functions without any return value. We declare them as functions for convenience so that we can call the routines from an Access macro (Step 3), which isn't possible if we declare them as Subs.
Public Sub MyGlobalErrorHandler() LogErrorToFile End Sub Public Sub LogErrorToFile() Dim FileNum As Long Dim LogLine As String On Error Resume Next ' If this procedure fails, something fairly major has gone wrong. FileNum = FreeFile Open "C:\ErrorLog.txt" For Append Access Write Lock Write As FileNum Print #FileNum, Now() & " - " & CStr(ErrEx.Number) & " - " & CStr(ErrEx.Description) 'We will separate the call stack onto separate lines in the log With ErrEx.CallStack Do Print #FileNum, " --> " & .ProjectName & "." & _ .ModuleName & "." & _ .ProcedureName & ", " & _ "#" & .LineNumber & ", " & _ .LineCode & vbCrLf Loop While .NextLevel End With Close FileNum End Sub Public Sub MyTestSub() Debug.Print 1 / 0 End SubThis routine (above) is simply logging every error that occurs to a log file on your C drive. Nothing fancy for this example.
MyTestSubMyTestSub was one of the subroutines in the example code that I made you copy & paste over - it simply causes a division by zero exception. You should now see the new default Vista dialog in all it's glory:
iTech Masters | VAT: GB202994606 | Terms | Sitemap | Newsletter