|
 |
access thread: Error Trapping Syntax Needed
Message #1 by "Gregory Serrano" <SerranoG@m...> on Thu, 18 Jul 2002 17:53:20
|
|
Given that error messages in Access can be quite cryptic, I wanted to
design my own error message that gives the user these bits of information
with instructions to call me (in case of really weird errors): the error
number, a description of the error, the form where the error is generated,
the event that caused the error, and the line number of the procedure
where the error occured.
Assuming I have a form open, I know these variables exist:
Error No. Err.Number
Error Description Err.Description
Form Name Me.Form.Name
Are there variables that go something like this?
Event Name Me.EventProcedure.Name
Line No. Err.LineNumber
Obviously, those two are not real. Are there ones that actually work or
does it have to be programmed? If so, can you supply code?
Sample Error Message Code:
Msgbox "An error has occured in " & Me.Form.Name & " with event " & _
Me.EventProdecure.Name & " on line no. " & Err.LineNumber & _
". Please contact Greg." & vbCRLF & vbCRLF & Err.Description, _
vbExclamation, "Error " & Err.Number
Sample of what the user would see:
A message box opens with "Error 2124" in the title bar and it says,
"An error has occured in frmCalculations with event txtSalary_AfterUpdate
on line no. 5. Please contact Greg
{Access Error Description here}"
Thanks.
Greg
Message #2 by "cdebiasio@t... on Thu, 18 Jul 2002 19:23:04 +0200 (CEST)
|
|
Hi!!!
No, there're not such variables, sorry. All what you can do is to set a module
(or form) level variable with the name of the procedure (let's say,
msProcName), and set it as the first line of code in each and every function or
call in your code. That's it. No way to retrieve a "line", as far as I know.
If you need serious debugging, try FMS products. They are just the best.
HTH
Claudio de Biasio
Team 97 S.r.l.
Quoting Gregory Serrano <SerranoG@m...>:
> Given that error messages in Access can be quite cryptic, I wanted to
> design my own error message that gives the user these bits of
> information
> with instructions to call me (in case of really weird errors): the
> error
> number, a description of the error, the form where the error is
> generated,
> the event that caused the error, and the line number of the procedure
> where the error occured.
>
> Assuming I have a form open, I know these variables exist:
>
> Error No. Err.Number
> Error Description Err.Description
> Form Name Me.Form.Name
>
> Are there variables that go something like this?
>
> Event Name Me.EventProcedure.Name
> Line No. Err.LineNumber
>
> Obviously, those two are not real. Are there ones that actually work or
>
> does it have to be programmed? If so, can you supply code?
>
> Sample Error Message Code:
>
> Msgbox "An error has occured in " & Me.Form.Name & " with event " &
> _
> Me.EventProdecure.Name & " on line no. " & Err.LineNumber & _
> ". Please contact Greg." & vbCRLF & vbCRLF & Err.Description, _
> vbExclamation, "Error " & Err.Number
>
> Sample of what the user would see:
>
> A message box opens with "Error 2124" in the title bar and it says,
>
> "An error has occured in frmCalculations with event
> txtSalary_AfterUpdate
> on line no. 5. Please contact Greg
>
> {Access Error Description here}"
>
>
> Thanks.
> Greg
>
Message #3 by "John Ruff" <papparuff@c...> on Thu, 18 Jul 2002 10:24:25 -0700
|
|
You might want to go to
http://www.databaseadvisors.com/downloads/index.htm wordwrapping) and
check out the VBErrorHandler program. I haven't used it but I believe
it might serve your purpose with some tweaking. I personnally use the
ErrorHandler class form FMS Inc's Total Visual Sourcebook 2000. You can
review it at http://www.fmsinc.com/products/sourcebook/ (watch
wordwrapping)
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
www.noclassroom.com
Live software training
Right over the Internet
Home: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: Gregory Serrano [mailto:SerranoG@m...]
Sent: Thursday, July 18, 2002 5:53 PM
To: Access
Subject: [access] Error Trapping Syntax Needed
Given that error messages in Access can be quite cryptic, I wanted to
design my own error message that gives the user these bits of
information
with instructions to call me (in case of really weird errors): the
error
number, a description of the error, the form where the error is
generated,
the event that caused the error, and the line number of the procedure
where the error occured.
Assuming I have a form open, I know these variables exist:
Error No. Err.Number
Error Description Err.Description
Form Name Me.Form.Name
Are there variables that go something like this?
Event Name Me.EventProcedure.Name
Line No. Err.LineNumber
Obviously, those two are not real. Are there ones that actually work or
does it have to be programmed? If so, can you supply code?
Sample Error Message Code:
Msgbox "An error has occured in " & Me.Form.Name & " with event " & _
Me.EventProdecure.Name & " on line no. " & Err.LineNumber & _
". Please contact Greg." & vbCRLF & vbCRLF & Err.Description, _
vbExclamation, "Error " & Err.Number
Sample of what the user would see:
A message box opens with "Error 2124" in the title bar and it says,
"An error has occured in frmCalculations with event
txtSalary_AfterUpdate
on line no. 5. Please contact Greg
{Access Error Description here}"
Thanks.
Greg
Message #4 by "John Ruff" <papparuff@c...> on Thu, 18 Jul 2002 11:04:06 -0700
|
|
To trap the line-number you can use the Erl function BUT you must
line-number your code.
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
www.noclassroom.com
Live software training
Right over the Internet
Home: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: cdebiasio@t... [mailto:cdebiasio@t...]
Sent: Thursday, July 18, 2002 10:23 AM
To: Access
Subject: [access] Re: Error Trapping Syntax Needed
Hi!!!
No, there're not such variables, sorry. All what you can do is to set a
module
(or form) level variable with the name of the procedure (let's say,
msProcName), and set it as the first line of code in each and every
function or
call in your code. That's it. No way to retrieve a "line", as far as I
know.
If you need serious debugging, try FMS products. They are just the best.
HTH
Claudio de Biasio
Team 97 S.r.l.
Quoting Gregory Serrano <SerranoG@m...>:
> Given that error messages in Access can be quite cryptic, I wanted to
> design my own error message that gives the user these bits of
> information
> with instructions to call me (in case of really weird errors): the
> error
> number, a description of the error, the form where the error is
> generated,
> the event that caused the error, and the line number of the procedure
> where the error occured.
>
> Assuming I have a form open, I know these variables exist:
>
> Error No. Err.Number
> Error Description Err.Description
> Form Name Me.Form.Name
>
> Are there variables that go something like this?
>
> Event Name Me.EventProcedure.Name
> Line No. Err.LineNumber
>
> Obviously, those two are not real. Are there ones that actually work
> or
>
> does it have to be programmed? If so, can you supply code?
>
> Sample Error Message Code:
>
> Msgbox "An error has occured in " & Me.Form.Name & " with event " &
> _
> Me.EventProdecure.Name & " on line no. " & Err.LineNumber & _
> ". Please contact Greg." & vbCRLF & vbCRLF & Err.Description, _
> vbExclamation, "Error " & Err.Number
>
> Sample of what the user would see:
>
> A message box opens with "Error 2124" in the title bar and it says,
>
> "An error has occured in frmCalculations with event
> txtSalary_AfterUpdate on line no. 5. Please contact Greg
>
> {Access Error Description here}"
>
>
> Thanks.
> Greg
>
|
|
 |