A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

"Overflow" message in UNION query



 
 
Thread Tools Display Modes
  #1  
Old January 2nd, 2008, 11:57 PM posted to microsoft.public.access.queries
Mark Wickett[_2_]
external usenet poster
 
Posts: 1
Default "Overflow" message in UNION query

Hi,

I have a UNION query that has started to generate an "Overflow" error
message when I execute it.

The SQL is "select * from query1 union select * from query2".

Both "query1" and "query2" execute fine when I try them separately - I only
get the "Overflow" in the union query. Both "query1" and "query2" have
identical fields (20 of them) in identical formats - the data is just sourced
from two distinct tables. Only "query1" has a calculation to add two numbers
together, so I can't see anything likely to cause a "divide by zero" error.

What is particularly puzzling is that this union query has been used
(unchanged) on a weekly basis for the last two years without error...!

Anyone have any ideas?

Thanks,
Mark

--
Mark Wickett - Adelaide Bank - Australia
  #2  
Old January 3rd, 2008, 01:01 AM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 2,364
Default "Overflow" message in UNION query

IF you are adding two integer numbers together and they exceed the
maximum value of an integer field (32K) then you will get an overflow error.

What are the field types involved?

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


Mark Wickett wrote:
Hi,

I have a UNION query that has started to generate an "Overflow" error
message when I execute it.

The SQL is "select * from query1 union select * from query2".

Both "query1" and "query2" execute fine when I try them separately - I only
get the "Overflow" in the union query. Both "query1" and "query2" have
identical fields (20 of them) in identical formats - the data is just sourced
from two distinct tables. Only "query1" has a calculation to add two numbers
together, so I can't see anything likely to cause a "divide by zero" error.

What is particularly puzzling is that this union query has been used
(unchanged) on a weekly basis for the last two years without error...!

Anyone have any ideas?

Thanks,
Mark

--
Mark Wickett - Adelaide Bank - Australia

  #3  
Old January 3rd, 2008, 01:17 AM posted to microsoft.public.access.queries
Mark Wickett
external usenet poster
 
Posts: 5
Default "Overflow" message in UNION query

Hi John,

Field types are both doubles - and actually, the nature of the source data
is that one field is always negative (or zero), so the addition could only
ever reduce the size of the result (it could possibly reduce it to a large
negative though...!) I have looked at these fields (source and result) to
confirm that these values are within acceptable ranges (-5000 to 2500000)

That aside, both sub-queries work independently without throwing this error
- so if it were a number blowout, I can't see how I wouldn't get this error
when I execute the sub-query?

Thanks,
Mark


"John Spencer" wrote:

IF you are adding two integer numbers together and they exceed the
maximum value of an integer field (32K) then you will get an overflow error.

What are the field types involved?

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


Mark Wickett wrote:
Hi,

I have a UNION query that has started to generate an "Overflow" error
message when I execute it.

The SQL is "select * from query1 union select * from query2".

Both "query1" and "query2" execute fine when I try them separately - I only
get the "Overflow" in the union query. Both "query1" and "query2" have
identical fields (20 of them) in identical formats - the data is just sourced
from two distinct tables. Only "query1" has a calculation to add two numbers
together, so I can't see anything likely to cause a "divide by zero" error.

What is particularly puzzling is that this union query has been used
(unchanged) on a weekly basis for the last two years without error...!

Anyone have any ideas?

Thanks,
Mark

--
Mark Wickett - Adelaide Bank - Australia


  #4  
Old January 3rd, 2008, 03:04 AM posted to microsoft.public.access.queries
Mark Wickett
external usenet poster
 
Posts: 5
Default "Overflow" message in UNION query

On further investigation John was right... deeper into one of the queries,
there is a field that casts a number into an integer where the expected range
of the source data is 0-1,000. However, a single record had an [erroneous]
value of around 50,000 - which of course, blows an Integer. Despite the error
being in the source, I still should have trapped it - now corrected and happy.

The fact that Access was happy to display the query's result on its own, but
not when unioned with another, misled my investigations...

Thanks to John for making me doubt my original assumptions!

Regards,
Mark

"Mark Wickett" wrote:

Hi John,

Field types are both doubles - and actually, the nature of the source data
is that one field is always negative (or zero), so the addition could only
ever reduce the size of the result (it could possibly reduce it to a large
negative though...!) I have looked at these fields (source and result) to
confirm that these values are within acceptable ranges (-5000 to 2500000)

That aside, both sub-queries work independently without throwing this error
- so if it were a number blowout, I can't see how I wouldn't get this error
when I execute the sub-query?

Thanks,
Mark


"John Spencer" wrote:

IF you are adding two integer numbers together and they exceed the
maximum value of an integer field (32K) then you will get an overflow error.

What are the field types involved?

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'================================================= ===


Mark Wickett wrote:
Hi,

I have a UNION query that has started to generate an "Overflow" error
message when I execute it.

The SQL is "select * from query1 union select * from query2".

Both "query1" and "query2" execute fine when I try them separately - I only
get the "Overflow" in the union query. Both "query1" and "query2" have
identical fields (20 of them) in identical formats - the data is just sourced
from two distinct tables. Only "query1" has a calculation to add two numbers
together, so I can't see anything likely to cause a "divide by zero" error.

What is particularly puzzling is that this union query has been used
(unchanged) on a weekly basis for the last two years without error...!

Anyone have any ideas?

Thanks,
Mark

--
Mark Wickett - Adelaide Bank - Australia


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.