473,383 Members | 1,795 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,383 software developers and data experts.

ErrorTable/Log

DD
I have started adding error traping code to my forms! should i make a
errortbl and log?
If so can i do this in a module as a function?
also i am not sure if i understand the process TO link the table with
the module/
Any help please
DD
Nov 12 '05 #1
1 1711
This really requires a fully fledged explanation of DAO/ADO and how the
Access Data Layer interacts with the rest of the application, but as I have
to work for a living I'll skip it.

Create a table (e.g. tbErrorLog) with the following fields:

ErrorLogID Autonumber
ErrorLogNumber Number (preferably of the Long variety)
ErrorLogDescription Text (255)
ErrorLogLocation Text (255)

Create a query with the following SQL (to do this create a new query, go to
View/SQL View, then paste the SQL in) and call it appParmsErrorLog

PARAMETERS lngErr Long, txtDesc Text(255), txtLocation Text(255);
INSERT INTO tbErrorLog (ErrorLogNumber,ErrorLogDescription,ErrorLogLocati on)
VALUES (lngErr,txtDesc,txtLocation);

Create a module (e.g. modErrorLog) with the following function:

Public Function ErrorLog(ByVal plngError as Long, ByVal pstrLocation as
String) as Boolean

Dim qdfError as DAO.QueryDef

Set qdfError = CurrentDB.QueryDefs("appParmsErrorLog")

qdfError.Parameters("lngErr").Value = plngError
qdfError.Parameters("txtDesc").Value = Error(plngError)
qdfError.Parameters("txtLocation").Value = IIf(pstrLocation =
"",Null,pstrLocation)

qdfError.Execute

ErrorLog=True

Exit Function

ErrorLog_Err:
ErrorLog=False

End Function

Make sure you set a reference to the Microsoft DAO Library (as high a
version as you've got) and then amend your error handling code to something
like so:

Public Sub DoSomething

On Error Goto DoSomething_Err

'...misc code

Exit Sub

DoSomething_Err:
If Not ErrorLog(err,"frmSomething|DoSomething") Then
Msgbox "There was an error in the error recording
procedure",vbCritical,"Error"
Else
Msgbox "An error occurred and has been written to the error
log",vbInformation,"Error"
End If

End Sub

If you're feeling particularly adventurous you could modify it to include a
form which collects information from the user about what they were doing
when the error occurred. The basics should be there to get you started
though.

hth

~Ben
"DD" <da**********@bigpond.com.au> wrote in message
news:14*************************@posting.google.co m...
I have started adding error traping code to my forms! should i make a
errortbl and log?
If so can i do this in a module as a function?
also i am not sure if i understand the process TO link the table with
the module/
Any help please
DD

Nov 12 '05 #2

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

Similar topics

6
by: Dave C. | last post by:
Hello, I have created the following trigger: CREATE TRIGGER tr_UDFTest ON UserDefinedFields FOR INSERT, UPDATE AS DECLARE @foobar varchar(100) SELECT @foobar= foobar FROM inserted IF (...
1
by: Kit Truong | last post by:
After compacting my database, I have the following in MSysCompactError ErrorCode, ErrorDescription, ErrorRecid, ErrorTable -1605,Could not find field 'Description'., ,tblFundClient -1017,Could...
6
by: GaryDave | last post by:
My school registration database has not been quite right after a recent compact and repair (done while I was away). Though most of the many forms and subforms are working normally, one form in...
3
by: JasonRMerrill | last post by:
I've got a system that's been corrupting repeatedly recently and I'm having trouble tracking down the cause. I've done as much reading as I can so far, but am starting to get lost as most of the...
22
by: Saurabh Saxena | last post by:
can we write the program to write no 1 to n without using switch,do,while,for,goto,if and conditional operator where n will be input by user.
4
by: gabriel | last post by:
Greetings, I am working on a project and cannot choose the best way to achieve this : I got a method which returns an error code like this : DISK_FULL or PERMISSION_DENIED. Those are...
0
by: schoultzy | last post by:
Hello Everyone, I have been trying to figure this one out for two days now. I have created a DataGridView which is populated by an ObjectDataSource. My problem occurs when I attempt to use the...
29
JamesDC
by: JamesDC | last post by:
Hey all, I have two problems with trying to upgrade an access file, not written by myself. This first is that I'm trying to change the items on a dropbox list, and they are linked with the...
1
by: krndhi1983 | last post by:
Hi to All, I am using Windows XP running IIS 6.0.I am developing a project using vb.net 1.1 with SQL Server 2000.It is a mobile project.So i am also using Pocket PC 2002 with SQL CE 2.0.When...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.