Suppressin DIV/0 in Access reports

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    Suppressin DIV/0 in Access reports

    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

    #2
    Re: Suppressin DIV/0 in Access reports

    "Mike" <mike_kenyon@ti scali.co.uk> wrote in message
    news:732403d0.0 310200905.5ae66 38d@posting.goo gle.com...[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


    Comment

    • Peter Miller

      #3
      Re: Suppressin DIV/0 in Access reports


      Rick,

      On Mon, 20 Oct 2003 12:35:26 -0500, "Rick Brandt"
      <rickbrandt2@ho tmail.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

      Comment

      • Mike

        #4
        Re: Suppressin DIV/0 in Access reports

        Thanks a lot guys - your solutions worked!


        Peter Miller <pmiller@pksolu tions.com> wrote in message news:<ul78pvkne h3g7qrmucarfb10 bhggq7o4qt@4ax. com>...[color=blue]
        > Rick,
        >
        > On Mon, 20 Oct 2003 12:35:26 -0500, "Rick Brandt"
        > <rickbrandt2@ho tmail.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]

        Comment

        Working...