Field value on a report

Grezzo

Registered User.
Local time
Today, 18:42
Joined
Feb 28, 2005
Messages
13
Probably a real simple one here guys. :o

I need to hide a field and move up other fields on a report if it is empty.

I put this code in the onOpen property:

If Reports!Invoice!Item1.Value = "" Then Reports!Invoice!Item1.Visible = False

I give me an error though. it says "You entered an expression that has no value"

What am i doing wrong? :confused:

Cheers
 
Last edited:
The error your getting is because you cannot make reference a null value. Try using NZ check it eg:-

If NZ(Reports!Invoice!Item1.Value,"") = "" Then Reports!Invoice!Item1.Visible = False

I suspect your other fields will not move up though once you hide this field. You may need to loop through the visible controls and set the top value of each one back a bit.
 
In the Detail On Format event
If IsNull(Me.MyControl) Then
Me.MyControl.Visible = False
Else
Me.MyControl.Visible = True
End If

also make sure the CanShrink properties are set to yes
 
Rich is right, I think, you need the on format event where the control resides, if you're going to alter properties of controls depending on the value of it, but, couldn't you just enter a criterion in the query? I e " where yourfield is not Null", by doing that, you wouldn't need any code at all.
 

Users who are viewing this thread

Back
Top Bottom