Connecting Tech Pros Worldwide Help | Site Map

Suppressin DIV/0 in Access reports

Mike
Guest
 
Posts: n/a
#1: November 12th, 2005, 03:31 PM
Hi,

I have an Access report which has two fields from a database on it. I
have a third field which is just a textbox that divides one by
another. My question/problem is that if the dividing field is 0 then
I get a DIV/0 in my report.

Ideally I would like it to say if field3 is div/0 then print 0.

Any ideas/work arounds would be greatly appreciated.

Regards
Mike
Rick Brandt
Guest
 
Posts: n/a
#2: November 12th, 2005, 03:32 PM

re: Suppressin DIV/0 in Access reports


"Mike" <mike_kenyon@tiscali.co.uk> wrote in message
news:732403d0.0310200905.5ae6638d@posting.google.c om...[color=blue]
> Hi,
>
> I have an Access report which has two fields from a database on it. I
> have a third field which is just a textbox that divides one by
> another. My question/problem is that if the dividing field is 0 then
> I get a DIV/0 in my report.
>
> Ideally I would like it to say if field3 is div/0 then print 0.[/color]

IIf(field2=0, 0, field1/field2)


--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


Peter Miller
Guest
 
Posts: n/a
#3: November 12th, 2005, 03:32 PM

re: Suppressin DIV/0 in Access reports



Rick,

On Mon, 20 Oct 2003 12:35:26 -0500, "Rick Brandt"
<rickbrandt2@hotmail.com> wrote in comp.databases.ms-access:
[color=blue][color=green]
>> I have an Access report which has two fields from a database on it. I
>> have a third field which is just a textbox that divides one by
>> another. My question/problem is that if the dividing field is 0 then
>> I get a DIV/0 in my report.
>>
>> Ideally I would like it to say if field3 is div/0 then print 0.[/color]
>
>IIf(field2=0, 0, field1/field2)[/color]

That certainly answers the original question, but isn't the original
question suspect? Why does the OP want 0 to represent both 0/N and
0/0? In general, one should really be distinguishing between 0/0 and
0, or more specifically, the formula should be something like:

IIf(field2=0, 'n/a', field1/field2)

or, at least

IIf(field2=0, null, field1/field2)



Peter Miller
__________________________________________________ __________
PK Solutions -- Data Recovery for Microsoft Access/Jet/SQL
Free quotes, Guaranteed lowest prices and best results
www.pksolutions.com 1.866.FILE.FIX 1.760.476.9051
Mike
Guest
 
Posts: n/a
#4: November 12th, 2005, 03:33 PM

re: Suppressin DIV/0 in Access reports


Thanks a lot guys - your solutions worked!


Peter Miller <pmiller@pksolutions.com> wrote in message news:<ul78pvkneh3g7qrmucarfb10bhggq7o4qt@4ax.com>. ..[color=blue]
> Rick,
>
> On Mon, 20 Oct 2003 12:35:26 -0500, "Rick Brandt"
> <rickbrandt2@hotmail.com> wrote in comp.databases.ms-access:
>[color=green][color=darkred]
> >> I have an Access report which has two fields from a database on it. I
> >> have a third field which is just a textbox that divides one by
> >> another. My question/problem is that if the dividing field is 0 then
> >> I get a DIV/0 in my report.
> >>
> >> Ideally I would like it to say if field3 is div/0 then print 0.[/color]
> >
> >IIf(field2=0, 0, field1/field2)[/color]
>
> That certainly answers the original question, but isn't the original
> question suspect? Why does the OP want 0 to represent both 0/N and
> 0/0? In general, one should really be distinguishing between 0/0 and
> 0, or more specifically, the formula should be something like:
>
> IIf(field2=0, 'n/a', field1/field2)
>
> or, at least
>
> IIf(field2=0, null, field1/field2)
>
>
>
> Peter Miller
> __________________________________________________ __________
> PK Solutions -- Data Recovery for Microsoft Access/Jet/SQL
> Free quotes, Guaranteed lowest prices and best results
> www.pksolutions.com 1.866.FILE.FIX 1.760.476.9051[/color]
Closed Thread