A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IsNull code not working in report



 
 
Thread Tools Display Modes
  #1  
Old April 22nd, 2010, 09:14 PM posted to microsoft.public.access.reports
jerry001 via AccessMonster.com
external usenet poster
 
Posts: 7
Default IsNull code not working in report

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!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/201004/1

  #2  
Old April 22nd, 2010, 09:42 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default 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!

  #3  
Old April 22nd, 2010, 11:32 PM posted to microsoft.public.access.reports
jerry001 via AccessMonster.com
external usenet poster
 
Posts: 7
Default IsNull code not working in report

Thank you for the quick response but that won't work.
I get the "entered an expression that has no value" error.

As you guessed the problem is that the field and the label remain visible.
When I enter the code without the "If" statements it all works fine and hides
the Label and Field.
(Just the "Me.Field.Visible= False" line..)
So I suppose that there is something that's blocking access from recognizing
the value of this field as Null. It's a mystery to me because I am using the
same code in a form and it works just fine!


Any other suggestions?

thanx!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/201004/1

  #5  
Old April 24th, 2010, 12:43 AM posted to microsoft.public.access.reports
Gina Whipp
external usenet poster
 
Posts: 3,500
Default IsNull code not working in report

Jerry001,

Try...

If Me.Field1 = "" Then
Me.Field1.Visible = False
Me.label1.Visible = False
Else
Me.Field1.Visible = True
Me.label1.Visible = True
End If


--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"jerry001 via AccessMonster.com" u48786@uwe wrote in message
news:a6ee5ee0a50ec@uwe...
Thank you for the quick response but that won't work.
I get the "entered an expression that has no value" error.

As you guessed the problem is that the field and the label remain visible.
When I enter the code without the "If" statements it all works fine and
hides
the Label and Field.
(Just the "Me.Field.Visible= False" line..)
So I suppose that there is something that's blocking access from recognizing
the value of this field as Null. It's a mystery to me because I am using the
same code in a form and it works just fine!


Any other suggestions?

thanx!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/201004/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.