Results 1 to 2 of 2
2003-12-24, 11:38 #1
- 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
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
I cannot see why the IsNull command is not working.
2003-12-24, 11:57 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 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.