IsNull code not working in report
It is possible that the field is not null but contains a zero-length string.
Try changing the test to
IF Len(Me.Field1 & vbnullstring) = 0 Then
Me.Field1.Visible = False
Me.label1.Visible = False
Else
Me.Field1.Visible = True
Me.label1.Visible = True
End If
If that does not work for you perhaps you can expand a bit on what "It does
not work." means. Does the label remain visible when you want it hidden? Or
does the space not shrink?
Also, it might help if you tell use WHERE (which event you are using)
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
jerry001 via AccessMonster.com wrote:
Ok I have a dbase with 5 tables
I need to print reports for each table but since there are many null values I
need to hide them (and their Labels as well).
I used the following code
If IsNull(Me.Field1) Then
Me.Field1.Visible = False
Me.label1.Visible = False
Else
Me.Field1.Visible = True
Me.label1.Visible = True
End If
It does not work.
Most of the fields are text fields.
The Canshrink/Cangrow var is True
The following code works for the forms.. but not the reports...
I read rellevant threads but still no luck!
Any help will be greatly appreciated!
|