473,846 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SubformCo nt.Form!txtUsag e,"") = "' Then
Msg "There's a problem"
GoTo Exit_Sub
End If

Exit_Sub
DoCmd.Echo True
DoCmd.SetWarnin gs = True

Err_Ctrl:
errMsgStr = ""
ctrlfnctnm = "ProcedureN ame"
Call Formname_err(Er r.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.SubformCo nt.Form!txtUsag e,"") = "' 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(Er r.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.c om
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #1
10 3773
"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.Deco mpile
(Google for instructions) and Compact your database.If the error persists,
post the code to Formname_err(da vid)"robert d via AccessMonster.c om"
<u6836@uwe> wrote in message news:5ba7892970 a13@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.c om
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.c om" <u6836@uwe> wrote in message
news:5ba7892970 a13@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.SubformCo nt.Form!txtUsag e,"") = "' Then
Msg "There's a problem"
GoTo Exit_Sub
End If

Exit_Sub
DoCmd.Echo True
DoCmd.SetWarnin gs = True

Err_Ctrl:
errMsgStr = ""
ctrlfnctnm = "ProcedureN ame"
Call Formname_err(Er r.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.SubformCo nt.Form!txtUsag e,"") = "' 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(Er r.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.c om
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.SubformCo nt.Form!txtUsag e,"") = "' 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.SubformCo nt.Form!txtUsag e,"") = "' 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.c om
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.c om
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.SubformCon t.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.c om
http://www.accessmonster.com/Uwe/For...ccess/200602/1
Feb 10 '06 #9
robert d via AccessMonster.c om 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, "MyProcedureNam e", 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

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

Similar topics

0
981
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 name="ProposalTemplateNameSpaces" type="System.Configuration.NameValueSectionHandler" /> </configSections>
4
6025
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
2453
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 connection, and this error yet occurs. Someone knows why this ?
3
16260
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 strange error. In your experience, where I should looking to find the real error? Surely the sintax of glut is correct... gcc.exe -c glut_bitmap.c -o glut_bitmap.o -I"C:/Dev-Cpp/include" -I"../../include" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG...
6
61599
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 here. Error Returned mySQL query error: SELECT MIN(pid) as pid FROM ib_posts WHERE queued=0 AND topic_id=85734 AND post_date 1160298086 LIMIT 0,1
2
10304
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 String Select Case MSComm1.CommEvent ' Event messages. Case comEvReceive
9
9574
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 function _main assign2.obj Thanks a lot ! Here is the code:
1
4603
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 always get the following error (in VS 2005): Compiling...
3
5204
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 more complicated now. Anyway, here's the error: "Parse error: syntax error, unexpected T_VARIABLE in /home/xxx/public_html/yyy/zzz/contactengine.php on line 1" It's a contact form from css-tricks, when I submit that's what I get.
0
9879
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9725
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10705
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7877
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7050
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5714
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5906
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.