Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Thanked 0 Times in 0 Posts

    wrong IsNull command (Access 2000)

    I receive the foolwoing error in my report :
    "You entered an expression that has no value"

    In my report i am summing up the all orders with the control
    This control is called Bonus. I have then another control called
    GrandTotal that calculates the bonus like that:

    Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
    Me![bonus] = Me![Sum] * rate
    Me![TotalBonus] = Me![GrandTotal] * 5/100
    End Sub

    The report opens ok in case the bonus is not null.Otherwise i receive
    the above message. I have tried the following code but with no suucess:

    Private Sub Report_Open(Cancel As Integer)
    If IsNull(Me![bonus]) Then
    MsgBox " There are no orders ", vbExclamation
    Me![bonus].Value = 0
    Exit Sub
    End If
    End Sub

    I cannot see why the IsNull command is not working.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 28 Times in 28 Posts

    Re: wrong IsNull command (Access 2000)

    If Bonus is a bound control, i.e. its control source is not blank, it doesn't make sense to set its value in a report.
    If Bonus is unbound, I don't see why the error would occur.

    By the way, there should be no need to use code to do this; you should be able to use calculated controls. Oh, and using Sum as the name of a field or control is dangerous, since Sum is also a built-in function.

Posting Permissions

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