CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2014
    Posts
    1

    Division by Zero error

    I am receiving a division by zero error in relation to the following:-

    (Sum ({@Payments},{aps_group.code})/Sum ({@Invoice},{aps_group.code}))*100

    It is strange, as the report was written some time ago and this error has only just appeared.

    I am not particulary au fait with Crystal Reports, so a laymans response would be appreciated.

    I am using Crystal Reports XI if that helps.

    Thank you in advance.

    BASS

  2. #2
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Division by Zero error

    Code:
    If Sum ({@Invoice},{aps_group.code})) <> 0 Then
        (Sum ({@Payments},{aps_group.code})/Sum ({@Invoice},{aps_group.code}))*100
    Else
        0
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3
    Join Date
    Feb 2015
    Posts
    11

    Re: Division by Zero error

    If the result should equal 100% for no issues, simply force the formula to display 100 if Zero result.

    Code:
    If Sum ({@Invoice},{aps_group.code})) <> 0 Then
        (Sum ({@Payments},{aps_group.code})/Sum ({@Invoice},{aps_group.code}))*100
    Else
        100

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured