# Thread: Multiplying by 0 (Access 2000)

1. ## Multiplying by 0 (Access 2000)

How to avoid the error in a query when one of the 2 fields has a 0 value?
My expression is
field1*field2/field1
However when the value of the field1 is say 0, i want to divide
field2/field1,that is to say to avoid the multiplication by 0, which gives 0

2. ## Re: Multiplying by 0 (Access 2000)

Are you sure about you expression ?
<hr>However when the value of the field1 is say 0, i want to divide
field2/field1<hr>
If field1 is 0 then you have a division by 0 and this will always give an error.

3. ## Re: Multiplying by 0 (Access 2000)

You seem to confuse multiplication and division.
Multiplication: 6 * 2 = 12
Division: 6 / 2 = 3
You can multiply by any number, including 0, for example 6 * 0 = 0
You can NOT divide by 0. If you try to calculate 6 / 0, you get an error.

What do you want to accomplish? Your expression isn't useful, field1*field2/field1 results in field2 unless field1 is 0.

4. ## Re: Multiplying by 0 (Access 2000)

Please accept my apologies to both of you. I am really sorry to have muddled my expression.I have corrected it to read as follows

[field1]/[pack]+[field2]

Once again please excuse me for my mistake.
In my expression i want to round down the figures.Say if I have 4.98 want the number to round down to 4.
I tried with Int as
Int[field1]/[pack]+[field2]
But Acces didnt accept that.Any reason?

5. ## Re: Multiplying by 0 (Access 2000)

Int is a function, its argument must be between parentheses ( and ). So try

Int([field1]/[pack]+[field2])

6. ## Re: Multiplying by 0 (Access 2000)

Thank you, Hans ! I will try it.Just to mention another problem.I regret to find that my query with the calculated field [field1]/[pack]+[field2]
seems more difficult than i thought.The point is, that i must include a condition:
the expression should take place only when pack is less than 6, otherwise
i should only divide field1 to pack and not add field2.
Can i put it into the query ?

7. ## Re: Multiplying by 0 (Access 2000)

Try
<code>
Int([field1]/[pack]+IIf([pack]<6,[field2],0))
</code>
The IIf function can be used to include conditional values within an expression.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•