473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Form level error handling

Hi

Is it possible to handle errors at form level that are not caught by the
error handlers within the form subs?

Regards
Nov 13 '05 #1
2 1509
On Tue, 2 Nov 2004 12:45:58 -0000, "John" <Jo**@nospam.infovis.co.uk>
wrote:

Will the Form_Error event work for you?
-Tom.
Hi

Is it possible to handle errors at form level that are not caught by the
error handlers within the form subs?

Regards


Nov 13 '05 #2
> Is it possible to handle errors at form level that are not caught by the
error handlers within the form subs?


What kind of error?

Here's an error handling routine that has worked nicely for me - I use it on
every sub in the project

[code on Form]
Public Sub cmdProcName_Click()
On Error GoTo HandleErr
[code omitted]
Exit_Here:
On Error Resume Next
Exit Sub
HandleErr:
Select Case Err.Number
Case Else
modHandler.LogErr ("frm0"), ("cmdProcName_Click")
End Select
Resume Exit_Here
End Sub

[standard module modHandler]
Public Sub LogErr(fn, pn)
Dim strErrMsg As String
Dim strErrSrc As String
Dim strSql As String
strErrMsg = "Error Number " & Err.Number & ": " & Err.Description
strErrSrc = vbCrLf & vbCrLf & fn & "." & pn
MsgBox strErrMsg & strErrSrc, vbCritical, " Unexpected Error"
On Error GoTo Exit_Here
strSql = "INSERT INTO tblErrorLog ( [ErrMsg], [ErrFrm], [ErrPrc] )
VALUES (" & _
Chr(34) & strErrMsg & Chr(34) & ", " & Chr(34) & fn & Chr(34) & ", " &
Chr(34) & _
pn & Chr(34) & ")"
DoCmd.SetWarnings False
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
Exit_Here:
Exit Sub
End Sub
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
2
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event...
4
by: David Lozzi | last post by:
Howdy, I found a nice little book called ASP.NET 2.0 Cookbook by Michael A Kittel and Geoffrey LeBlond. Anyway, they have some instructions on how to setup application level error handling. Most...
2
by: nguyenminhhai | last post by:
Hi everyone, I'm reading "The C++ Programming Language" (Bjarne Stroustrup, 3rd edition). At page 193, he said "Doing error handling using the same level of abstraction as the code that caused the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.