Error trap for a divide by zero error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to show a blank in my calculation field instead of #Div/0! when one of
my numbers is a zero. The code below was given to me and I do not
undertand it. Please explain how to do this in Novice level, please!

2/10 = .4
2/0 = #Div/0


Dim x,y,z
x=10
y=0
z=0
On error resume next
 
SharonInGa said:
I need to show a blank in my calculation field instead of #Div/0!
when one of my numbers is a zero. The code below was given to me
and I do not undertand it. Please explain how to do this in Novice
level, please!

2/10 = .4
2/0 = #Div/0


Dim x,y,z
x=10
y=0
z=0
On error resume next

Um, that's not code in any meaningful sense, so it's no wonder you
didn't understand it. Was there more to it?

Are you doing this calculation in the controlsource of a control on a
form? If so, I would think you could use something like this:

=IIf([txtDenominator]=0, Null, [txtNumerator]/[txtDenominator)

, where you would substitute your own field or control names for
"txtNumerator" and "txtDenominator".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dividing by Zero in Access Reports 14
Scrabble Value calculation for Welsh words 0
Merge from a table 3
Dividing by zero 2
divide by zero 1
divide by zero error 4
3 list boxes 1 answer 9
Combine 3 List box Choices 1

Back
Top