473,399 Members | 2,478 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,399 software developers and data experts.

Error occurring in error handler

I have a global error handler that up until today has
been working flawlessly. Let me first provide the relevant code

************************************************** **************

On Error GoTo Err_Ctrl

'This code is generating the error
If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then
Msg "There's a problem"
GoTo Exit_Sub
End If

Exit_Sub
DoCmd.Echo True
DoCmd.SetWarnings = True

Err_Ctrl:
errMsgStr = ""
ctrlfnctnm = "ProcedureName"
Call Formname_err(Err.Number, Err.Description, Err.Source, ctrlfnctnm,
errMsgStr)
Resume Exit_Sub

************************************************** ********************

I'm having to type the code in by hand today, so I won't include the
Formname_err procedure unless someone requests it.

The error is occuring on the following line:
If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then

I can only determine this original error that causes the code to go to the
Error Handler by stepping through the code. The error is:

"You entered and expression that has no value"

The error refers to the subform text box, txtUsage. This is a correct error
as this is the case.

HOWEVER:

Once the code enters the error handler, there is another error generated at
the following line of code:

Call Formname_err(Err.Number, Err.Description, Err.Source, ctrlfnctnm,
errMsgStr)

That error is "Run-time error '6' Overflow

This causes the error handler to fail and an "unhandled" error is displayed.

Now, I'm fairly certain that the error handler code is free of coding errors.
I raised an error to check that it was functioning correctly. The following
line was added before the line where the subform text box, txtUsage, causes
an error.

Err.Raise 13

With this raised error, the error handler works exactly as it is supposed to
and shows that error 13 has been generated and gives a description.

So, I guess there must be something about the error being generated because
of the subform textbox that is causing this problem.

Just to add, I do not use the Link Child/Master properties. Everything is
unbound.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #1
10 3729
"Run-time error '6'" Overflow is an error which is trapped bya processor
exception, then passed back up to your error handler.It doesn't have to come
from your code at all: it could bea bug in Access, or in Windows, or in your
code. In Access,it often comes from bad data, or because Access has madean
error evaluating a parameter, or because of database corruption.Decompile
(Google for instructions) and Compact your database.If the error persists,
post the code to Formname_err(david)"robert d via AccessMonster.com"
<u6836@uwe> wrote in message news:5ba7892970a13@uwe...
I have a global error handler that up until today has
been working flawlessly. Let me first provide the relevant code

************************************************** ************** --
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1

Feb 10 '06 #2
From what you posted, your Exit_Sub doesn't exit the sub. You need an "Exit
Sub" in there.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
"robert d via AccessMonster.com" <u6836@uwe> wrote in message
news:5ba7892970a13@uwe...
I have a global error handler that up until today has
been working flawlessly. Let me first provide the relevant code

************************************************** **************

On Error GoTo Err_Ctrl

'This code is generating the error
If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then
Msg "There's a problem"
GoTo Exit_Sub
End If

Exit_Sub
DoCmd.Echo True
DoCmd.SetWarnings = True

Err_Ctrl:
errMsgStr = ""
ctrlfnctnm = "ProcedureName"
Call Formname_err(Err.Number, Err.Description, Err.Source, ctrlfnctnm,
errMsgStr)
Resume Exit_Sub

************************************************** ********************

I'm having to type the code in by hand today, so I won't include the
Formname_err procedure unless someone requests it.

The error is occuring on the following line:
If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then

I can only determine this original error that causes the code to go to the
Error Handler by stepping through the code. The error is:

"You entered and expression that has no value"

The error refers to the subform text box, txtUsage. This is a correct error as this is the case.

HOWEVER:

Once the code enters the error handler, there is another error generated at the following line of code:

Call Formname_err(Err.Number, Err.Description, Err.Source, ctrlfnctnm,
errMsgStr)

That error is "Run-time error '6' Overflow

This causes the error handler to fail and an "unhandled" error is displayed.
Now, I'm fairly certain that the error handler code is free of coding errors. I raised an error to check that it was functioning correctly. The following line was added before the line where the subform text box, txtUsage, causes an error.

Err.Raise 13

With this raised error, the error handler works exactly as it is supposed to and shows that error 13 has been generated and gives a description.

So, I guess there must be something about the error being generated because of the subform textbox that is causing this problem.

Just to add, I do not use the Link Child/Master properties. Everything is
unbound.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1


Feb 10 '06 #3
I can see two things that might be causing you a headdache
1. If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then
if thats a copy paste of your code then you've got your final quote
marks wrong - you have a double quote followed by a single quote,
rather than two double or two singles... but this code shouldnt even
compile - it would give you an erro message saying that a "Then" is
expected.
2. Exit_sub:


has nothing in it that actually exits the sub. there should be an "Exit
Sub" statement in it. When the code gets to the end it will run right
through the exit_sub: section and go into err_crtl: - even if there is
no error.
But when the code tries to use an err object when there is none, the
resulting error you will get is an object not set error, not an
overflow error.

....in short - there's another problem somewhere else in the code.
1. Fix the above 2 errors
2. comment out your "on_error" instructions
3. run code and click debug on error to see exactly where the code
breaks.

Feb 10 '06 #4
Guys, thanks for the responses and pointing out my errors.

I noted in my post that I had to type the code in by hand (rather than copy)
and obviously I made mistakes. The actual code does have Exit Sub in it and
the quotes are correct (I blew it when typing in the code).

I tried David's suggestion of decompiling the code. I followed the method
advocated by Allen Browne - backup, compact, decompile, compact, compile,
backup.

The problem did not go away. I stepped through the code to watch it enter
the error handler. Once the error handler is entered because of the error
generated by the subform textbox, txtUsage, and before it gets to the line
that gives me Error #6, here are the error stats:

Err.Number = -2147352567
Err.Description = "You entered an expression that has no value"
Err.Source =

If I can't solve this I'll probably have to add code that prevents the first
error (subform textbox) from occurring or handle it separately.

Would a reasonable solution be to add an "If" or "Case" statement on the
error, i.e.

If Err.Number = -2147352567 Then

Of course, I don't want to do this, but I may not have a choice.

Any other ideas are greatly appreciated.

Thanks.

BillCo wrote:
I can see two things that might be causing you a headdache
1. If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then


if thats a copy paste of your code then you've got your final quote
marks wrong - you have a double quote followed by a single quote,
rather than two double or two singles... but this code shouldnt even
compile - it would give you an erro message saying that a "Then" is
expected.
2. Exit_sub:


has nothing in it that actually exits the sub. there should be an "Exit
Sub" statement in it. When the code gets to the end it will run right
through the exit_sub: section and go into err_crtl: - even if there is
no error.
But when the code tries to use an err object when there is none, the
resulting error you will get is an object not set error, not an
overflow error.

...in short - there's another problem somewhere else in the code.
1. Fix the above 2 errors
2. comment out your "on_error" instructions
3. run code and click debug on error to see exactly where the code
breaks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #5
> noted in my post that I had to type the code in by hand (rather than copy)
and obviously I made mistakes. The actual code does have Exit Sub in it and
the quotes are correct (I blew it when typing in the code).


....sorry for the crap advice then!
My best remain guess is that "Me.SubformCont.Form!txtUsage" doesnt
exist as addressed - which would explain why the code used to work but
doesnt anymore... something on the form has changed.

try inserting the line:
debug.print Me.SubformCont.Form!txtUsage
and see what hapens when the code hits it.

Feb 10 '06 #6
BillCo:

Maybe I should explain what I'm doing that causes the error. I'm creating a
complex chart that pulls data from a lot of tables does calcs, etc. One
subform contains values for parameters. The user can delete the rows shown
in this subform (continuous mode form) in order to tailor the output to
exactly what they want to see. Now what's shown in this first subform outputs
automatic (in code) calculational values to a second subform, which is the
one where I have the problem.

I was simply testing to see what happens if I delete all of the rows shown
on the first subform. This causes all rows shown in the second subform to
disappear (the second subform is also set to display as a continuous form).
And that is when the subform error appears. Which is fine, because the user
should not then press the "Calculate" button since there's nothing to
calculate. So, what I was trying to do was to check if there are values (see
first post) and then display a messagebox.

The more I think about it, I don't know why I even have the second subform.
It only ever displays one row, so there is no reason I couldn't replace it
with textboxes or labels on the main form. That will probably result in the
problem going away.

But I still don't understand why the error handler would fail. It should
just process the error like it has always processed all other errors.

When I insert your suggested line I get:

Run-time error '2427'

"You entered an expression that has no value"

It's interesting that the run-time error number is different now but the
message is the same as before. Is there any chance that the negative error
number (that I posted earlier) is what is causing the problem (ie. the fact
that it is negative and not positive)??

BillCo wrote:
noted in my post that I had to type the code in by hand (rather than copy)
and obviously I made mistakes. The actual code does have Exit Sub in it and
the quotes are correct (I blew it when typing in the code).


...sorry for the crap advice then!
My best remain guess is that "Me.SubformCont.Form!txtUsage" doesnt
exist as addressed - which would explain why the code used to work but
doesnt anymore... something on the form has changed.

try inserting the line:
debug.print Me.SubformCont.Form!txtUsage
and see what hapens when the code hits it.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #7
I think the error is primarily caused because when the last record is
removed from the subform then there are no instances of
"Me.SubformCont.Form!txtUsage" left to address, as it's continuous
forms... hence the "You entered an expression that has no value"
message when you tried my debug.print line of code. You are right
however - this all should be trapped by the error handler.

I'm at a loss to trace this one without stepping through your code
myself.
for instance whats going on in your Formname_err function? errMsgStr is
a zero length string - can Formname_er handle that? Where are errMsgStr
and ctrlfnctnm declaired?

Feb 10 '06 #8
Check my first post. You'll see that values are assigned to both errMsgStr
and ctrlfnctnm just prior to the line of code within the Error Handler that
is causing the Error Number 6 problem.

BillCo wrote:
I think the error is primarily caused because when the last record is
removed from the subform then there are no instances of
"Me.SubformCont.Form!txtUsage" left to address, as it's continuous
forms... hence the "You entered an expression that has no value"
message when you tried my debug.print line of code. You are right
however - this all should be trapped by the error handler.

I'm at a loss to trace this one without stepping through your code
myself.
for instance whats going on in your Formname_err function? errMsgStr is
a zero length string - can Formname_er handle that? Where are errMsgStr
and ctrlfnctnm declaired?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #9
robert d via AccessMonster.com wrote:
Check my first post. You'll see that values are assigned to both errMsgStr
and ctrlfnctnm just prior to the line of code within the Error Handler that
is causing the Error Number 6 problem.

Hi Robert,

Have you tried stepping through you code, one line at a time? I prefer
to comment out the on error line when I do this as I don't jump to my
error proc when the error occurs (also, comment out the on error goto in
any calling procedures if applicable).

As an unsolicited aside, I don't like universal error handling, myself.
I find I have far more flexibility handling errors within each
routine. At very least, on creating a new procedure I toss in the
following at the end:

Exit_Proc:

Exit Sub

Err_Proc:

Select Case Err.Number

Case Else

MsgBox "Error " & Err.Number & " " & Err.Description,
vbCritical, "MyProcedureName", Err.HelpFile, Err.HelpContext

Resume Exit_Proc

End Select

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Feb 10 '06 #10
> The problem did not go away. I stepped through the code to watch it enter

Can you post the error handler declaration and code? Also, (at the risk
of being obvious), you will get that error if you try to pass that error
number to an Integer variable.

(david)
"robert d via AccessMonster.com" <u6836@uwe> wrote in message
news:5bac7a7ea26e7@uwe...
Guys, thanks for the responses and pointing out my errors.

I noted in my post that I had to type the code in by hand (rather than
copy)
and obviously I made mistakes. The actual code does have Exit Sub in it
and
the quotes are correct (I blew it when typing in the code).

I tried David's suggestion of decompiling the code. I followed the method
advocated by Allen Browne - backup, compact, decompile, compact, compile,
backup.

The problem did not go away. I stepped through the code to watch it enter
the error handler. Once the error handler is entered because of the error
generated by the subform textbox, txtUsage, and before it gets to the line
that gives me Error #6, here are the error stats:

Err.Number = -2147352567
Err.Description = "You entered an expression that has no value"
Err.Source =

If I can't solve this I'll probably have to add code that prevents the
first
error (subform textbox) from occurring or handle it separately.

Would a reasonable solution be to add an "If" or "Case" statement on the
error, i.e.

If Err.Number = -2147352567 Then

Of course, I don't want to do this, but I may not have a choice.

Any other ideas are greatly appreciated.

Thanks.

BillCo wrote:
I can see two things that might be causing you a headdache
1. If Nz(Me.SubformCont.Form!txtUsage,"") = "' Then


if thats a copy paste of your code then you've got your final quote
marks wrong - you have a double quote followed by a single quote,
rather than two double or two singles... but this code shouldnt even
compile - it would give you an erro message saying that a "Then" is
expected.
2. Exit_sub:


has nothing in it that actually exits the sub. there should be an "Exit
Sub" statement in it. When the code gets to the end it will run right
through the exit_sub: section and go into err_crtl: - even if there is
no error.
But when the code tries to use an err object when there is none, the
resulting error you will get is an object not set error, not an
overflow error.

...in short - there's another problem somewhere else in the code.
1. Fix the above 2 errors
2. comment out your "on_error" instructions
3. run code and click debug on error to see exactly where the code
breaks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200602/1

Feb 13 '06 #11

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

Similar topics

0
by: helpful sql | last post by:
Hi all, I am getting an exception from asp.net application that says error creating section handler. Here is my configuration section from web.config file: <configSections> <section...
4
by: learning_C++ | last post by:
Hi, I try to use input = new istrstream(argv,strlen(argv)); in my code, but it always says error: " error: parse error before `(' token" please help me! Thanks, #include <map>
2
by: Ricardo Magalhães | last post by:
Hi, I using this code, to connect with a paradox file with ASP.NET. The first time its connect ok, but others times occurs the error: "ERROR - no error information available" I close all...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
6
by: Thaqalainnaqvi | last post by:
IPB WARNING mysql_query() : Unable to save result set (Line: 457 of /ips_kernel/class_db_mysql.php) There appears to be an error with the database. You can try to refresh the page by clicking...
2
by: herat007 | last post by:
hi , i have developed a prog in vb to send sms , but i get an error error:8020 "Error reading from comm port" my prog for mscomm_oncomm() is Private Sub MSComm1_OnComm() Dim strMessage As...
9
by: Trent | last post by:
Here is the error while using Visual Studio 2005 Error 1 error LNK2019: unresolved external symbol "void __cdecl print(int,int,int,int,int,int,int,int)" (?print@@YAXHHHHHHHH@Z) referenced in...
1
by: SQACPP | last post by:
I have an error when compiling a simple form project... I just start a new Form project and add a new PictureBox in a form(or anything that generate the .resx file) After that when compiling I...
3
by: brkseven | last post by:
Looking for help with this Contact Form. The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.