Results 1 to 8 of 8
  1. #1
    mikesal57 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    48

    Help with "Division by Zero"

    Hi All.....



    I have an expression....
    I "replaced the 0's with 99" in naodd field
    I still get error....

    Ideas?

    thxs

    Click image for larger version. 

Name:	3.JPG 
Views:	19 
Size:	45.4 KB 
ID:	44876Click image for larger version. 

Name:	1.JPG 
Views:	18 
Size:	208.5 KB 
ID:	44878Click image for larger version. 

Name:	2.JPG 
Views:	19 
Size:	116.8 KB 
ID:	44877

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Can't see any of your 5 query calculated fields, but it would seem obvious that one of them results in a divisor of zero in at least one record. That's all it would take.
    If one of those divisors is a field where 0 is the default value (in table design) then perhaps you have one record with a 0. Or you might be using Nz and substituting 0 when there is a null value.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    mikesal57 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    48
    Quote Originally Posted by Micron View Post
    Can't see any of your 5 query calculated fields, but it would seem obvious that one of them results in a divisor of zero in at least one record. That's all it would take.
    If one of those divisors is a field where 0 is the default value (in table design) then perhaps you have one record with a 0. Or you might be using Nz and substituting 0 when there is a null value.
    All the others run fine....its this last one thats hanging me up...Click image for larger version. 

Name:	a.JPG 
Views:	17 
Size:	104.9 KB 
ID:	44880Click image for larger version. 

Name:	b.JPG 
Views:	17 
Size:	20.3 KB 
ID:	44882
    Attached Thumbnails Attached Thumbnails b.JPG  

  4. #4
    mikesal57 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    48
    Quick question.....in that naodd field there are numbers like...... 0.2 - 0.6- 0.8 ..............is that a possible error?

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    If naodd = -1, then the divisor naodd +1 would be zero.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Also, if just one xWIN is not greater than zero, the IIF results in 0 for xWIN. I would think that you'll then have /Count([xWIN])*100 being /Count(0)*100 which would be division by zero. I'd copy the query, remove a field and test. Rinse and repeat until issue goes away. Then the issue is with the last field removed, or with a field which that field uses in a calculation. Once that is known I'd also look at the data pertaining to the field(s) involved in the calculation and look for data that would cause division by zero error. Alternatively, OP could post a zipped db copy here for analysis. The pictures aren't going to help much.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    mikesal57 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    48
    Quote Originally Posted by davegri View Post
    If naodd = -1, then the divisor naodd +1 would be zero.

    Your right dave...that was it .....I had about 50 fields with -1........So the zero's were put back and the -1 was taken out.....

    FIXED

    Thxs so much guys you had me looking in the right spots

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    Good you got it running right and thanks for the star!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 28
    Last Post: 03-23-2021, 11:02 AM
  2. Simple table relationships ("faces" to "spaces" to "chairs")
    By skydivetom in forum Database Design
    Replies: 36
    Last Post: 07-20-2019, 01:49 PM
  3. Replies: 12
    Last Post: 10-01-2018, 02:40 PM
  4. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  5. Replies: 1
    Last Post: 09-03-2014, 03:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums