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/Forums.aspx/access-reports/201004/1

0
jerry001
4/22/2010 8:14:34 PM
access.reports 4434 articles. 0 followers. Follow

4 Replies
1319 Views

Similar Articles

[PageSpeed] 13

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!
> 
0
John
4/22/2010 8:42:53 PM
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/Forums.aspx/access-reports/201004/1

0
jerry001
4/22/2010 10:32:41 PM
Where do you have this code?

Steve
santus@penn.com


"jerry001 via AccessMonster.com" <u48786@uwe> wrote in message 
news:a6ed2a10e9c21@uwe...
> 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/Forums.aspx/access-reports/201004/1
> 


0
Steve
4/22/2010 10:38:52 PM
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/Forums.aspx/access-reports/201004/1 

0
Gina
4/23/2010 11:43:30 PM
Reply:

Similar Artilces:

automatically generate weekly report and email out...?
Is it possible to generate a status report weekly and have it emailed on a pre-set schedule? In CRM 1.2 you can't do this unless you upgrade your Crystal Enterprise server license to a fully-functional one (a couple thousand bucks I think). With CRM 3.0 using SQL Reporting Services, I believe you will be able to program this in relatively easily. -- Matt Wittemann http://icu-mscrm.blogspot.com "David M" wrote: > Is it possible to generate a status report weekly and have it emailed on a > pre-set schedule? ...

Money 2004 Suddently Stopped Working
I have been using Microsoft Money 2004 for some time now and today it is suddently no longer worker. When I try to start it up it says: --------------------------- Microsoft Money --------------------------- Money has not installed correctly. Try installing again. Or, if you have installed from the Internet, make sure that you have downloaded all the components you need to run. --------------------------- OK --------------------------- So, I tried uninstalling and reinstalling Money, but to no avail. After playing around for a little while I found that if I gave myself Administrator ...

Installing Crystal Reports CRM Enhancement
I'm having a deceptively difficult time installing Crystal Reports to a client to customize our reports. I've installed CR 9.2.2 on my client yet the CRM Enhancement disk will not install because it thinks that CR 9.2.0 is installed. I verified the Crystal version 9.2.2.5705, and I have used both disks (Crystal and CRM Enhancement) several times before and I've never encountered this message. As anyone else seen this, and if so, how can I get the install to complete? -- Carroll Little Vis.align, LLC 610-692-3290 x3326 www.visalign.com ...

CODE for EXCEL output not executing in access
Hello, MS Access/Excel 2003 on XP PRO. I have a subroutine that outputs a query to an excel file and then formats it automatically, and everything works, I get no compile errors, except for one little failure. when I execute the line with the > in front of it is the problem. With obj_excel 'Excel application 'whole bunch of stuff in here With .activesheet.PageSetup > .PrintTitleRows = "$1:$1" 'plus other end with 'whole bunch of stuff in here end with this line does not happen. It executes, moves to the nex...

IsNull
I have a command button that fills in address, etc. information based on the value selected in a field. (This might seem strange, but there are good reasons for doing it this way in this case.) So the user selects a party from the combo box, then can either enter address info or can click the command button to fill in the most-recently-used data for that party. This works fine. However, if a party hasn't been selected from the list, I want to cancel the fill in of data. Currently if you click the command button while nothing is selected, it still gives the msgbox message that's ...

working with wage tables based on years worked
set up table that would feed column "current wage". Table would consist of years worked and associated wage. example: name years worked current wage TABLE Years Wage 0 10.00 1 12.00 2 12.50 etc for about 20 years Hi Ann So what is your question? Looks like plain data input to me! No calculations or anything like that required here. I would however enter the wages in columns, rather than rows. In that way you use one row per employee, so headings would be: Name | Year1 | Year 2| and so on Maybe an additional column ...

code placement
I am using the enable feature to disable area of my form. Should i be using it in the combo boxes after update function and the form load function? Thank you It should be defined in two palces 1. OnCurrent event of the form - will set the Enable section of the form when the form is loading and when you move between records 2. AfterUpdate event of the objects that responsible to the situation of this area -- Good Luck BS"D "scott04" wrote: > I am using the enable feature to disable area of my form. Should i be using > it in the combo boxes after update funct...

Need advice with ISNULL
Hi, ISNULL allows me to either return the data in a field or some specified value if the field is NULL. What I want to do is slightly different. I want to return 1 or a 0 based on whether or not there's data in the field. In other words, I don't want to return the data but a value of 1 if there is data. If there's no data, I want to return a 0. How do I do this? -- Thanks, Sam On 21/04/2010 15:56, Sam wrote: > Hi, > > ISNULL allows me to either return the data in a field or some specified > value if the field is NULL. > > What I want...

Imap work on Outlook Express but NOT on Outlook 2003
Hi, I originally configure the IMap on outlook 2003 sp2. However, I would only get the inbox. Tried IMap folder and Update folder list, None additiional folder showed and I also have this message 'The connection to the server is unavailable. Outlook must be online or connected to complete this aciton". Then I tried on 1 other machine and came up with the same error. Tried to look for solution on the net but no joy. I finally tried to configure on Outlook Express which work fine, I have all the required folders. I still need to get it work on Outlook 2003 as this is the requirement. ...

AddItem code sorta works?!?!
I have the following code to move items from the listbox to another listbox. It works, but almost. Once I have moved multiple items to the destination listbox I can see the many entries. What I don't get is why all the entries are not stored in the field for that table. I only get the first entry. Also, after I add the data on the form and go to the next record, the data doesn't change or clear out. Please help. My code below: Dim ctrlListBox As ListBox Dim FRM As Form, CTL As Control Dim varitem As Variant Dim strSQL As String Set FRM = For...

rating cells 1-5 colour coded HOW?
I would like to be able to give a cell a rating of 1-5 and colour coded but conditional formatting in excel 2002 only allows up to 3, by using 1 number as white cell means you can using a rating of 1-4. I required 1-5. I have tried to use coloured drop down menus but the cell colours do not carry across. Therefore can anyone tell me how I can type a number of 1 to 5 in a cell and that it will also show as a colour. -- Many thanks Jackie See response in .misc -- HTH Bob Phillips "treetop40" <treetop40@discussions.microsoft.com> wrote in message news:9FF944A2-F826-4...

code breaks in macro
I have a very simple macro below which cuts and pastes contents of one cell, then deletes a few columns. When running the macro I get the "Code execution has been interrupted" error. I can simply hit continue and the macro completes fine. Sometimes it goes all the way through. When it does break, it's not always at the same point. The macro was recorded using the "Record New Macro" menu functions and hasn't been altered. Any ideas why this might happen? Sub Macro1() Range("Q8").Select Selection.Cut Range("R8")....

Help with IIF ans IsNull!
Basically i have a drop down that i want controlling the Criteria for each field in my query to have an advanced search. If i leave a field blank the query comes up with nothing so i tried this: Code: IIf(IsNull([Forms]![Inventory Report Search]![Model]),Is Null,[Forms]![Inventory Report Search]![Model]) this is not working. how do i make is so if a field is blank it will return it as null or not even there. Note: also tried this; Code: Forms]![Inventory Report Search]![Model] Or Forms]![Inventory Report Search]![Model] Is Null works, But comes back as too complex after a few sea...

Application Security Code Access sequrity(CAS)
Hi! I'm reading a book from Microsoft Press (Exam 70-536) and it says the following "Exam Tip: For the exam, remember that CAS is significant only for partially trusted assemblies. The runtime completely ignores CAS declarations for fully trusted assemblies." Bolow is an example from the book and here I use some CAS declarations as you can see. Now what I don't understand is the last sentence which says "The runtime completely ignores CAS declarations for fully trusted assemblies" I mean my assemblies are fully trusted because they run in code group ...

Generate .NET Code
Does anybody know about a downloadable template for .NET packages? ...

spell check not working
My spell check in my vista program is not working on my email Define "not working". Any error message? -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Debra" <Debra@discussions.microsoft.com> wrote in message news:E236030E-6127-43E0-959B-680F5B4D0715@microsoft.com... > My spell check in my vista program is not working on my email Always include the complete error message. If it says something like "This language is no longer available..." then do the following: =20 In the main screen of Windows Mail, (no...

working minimized
can anyone tell me if there's a way to close the outlook and have it run minimized on my notification area (area where the clock and volume control is located) instead of my taskbar. what i'm trying to do is leave my outlook running checking my email account constantly but not have it minimized on my taskbar but only have an icon on the notification area. thank you all! lukas What version of Outlook "Lukas Beltrame" <lukasob@yahoo.com> wrote in message news:072b01c3d413$97a388d0$a301280a@phx.gbl... > can anyone tell me if there's a way to close the outlo...

Code 646 04-29-10
I try to install important updates for Microsoft Office Home and Student 2007, but it keeps failing to install the updates and gives a "code 646, Microsoft Update encountered an unknown error"... See if the solution in this thяead helps. http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.windowsupdate&p=1&tid=fbac43a8-02fd-4be2-9966-58028a3d3ff7&mid=706216e6-3dbe-44d6-b5a6-afc87618628a I hope this post is helpful. Let us know how it works ºut. Good luck -...

Rules work in manual, but not automatically
I've created some rules to filter some spam but they're not working when mail arrives, but do wrok when I 'Run Rules Now'. I can't figure this out, why would a rule work when I run it manually, but fail to work when new mail arrives? On Mon, 26 Jan 2004 19:26:11 -0500, sammy <user@nowhere.com> wrote: >I've created some rules to filter some spam but they're not working >when mail arrives, but do wrok when I 'Run Rules Now'. > >I can't figure this out, why would a rule work when I run it manually, >but fail to work when new mail arr...

Calendar and working time
Outlook 2003/Exchange Server Most of my team is located in different time zones. When scheduling meetings, I can see free/busy time for all attendees, adjusted to my time zone; however, there is no indication of working hours. Yes, I now I can limit my display to show my working hours. How can I see the actual scheduled working hours of everyone else, so to schedule a meeting when everyone is actually at work. The way it is now, after hours time appears to be free time, and I have no idea where these folks live. I've resorted to blocking on my calendar, all non-working time with ...

Modify Ranking Code
I currently have a table with three fields: ChgMS, Position and Rank (see example with test data below) ChgMS Position Rank 0.0576 2 1 0.0384 5 2 0.0452 6 3 0.0251 9 4 0.0296 9 4 0.0254 11 6 I currently use this logic in my query to create the Rank field: Rank: (Select Count (*) from [TableName] Where [Position] < [aliasTableName].[Position])+1 As you can see, where the Position is tied, so is the Rank. I want my ChgMS to be the tie breaker. So the end result should look like this: ChgMS Position Rank 0.0576 2 1 0.0384 5 2 0.0452 6 3 0.0296 9 4 0.0251 9 5 0.02...

Z reports- placing customer name under paid in and paid out
How can i list the names of customers on the x and z reports where paid on and paid to account has been made This cannot be done out of the box - the Z report is a summary report - to see details on layaways run a summary or detailed report from Store Ops Manager for that day - hope this helps..... "Andaiye" wrote: > How can i list the names of customers on the x and z reports where paid on > and paid to account has been made can the list of name be captured at all or is it that the entire summary report will have to be rebuilt to accommodate such. do u know how to g...

Testing a field for isnull
Private Sub Form_BeforeUpdate(Cancel As Integer) If IsNull(txtLastName) Then MsgBox "Please enter a last name!" DoCmd.GoToRecord , , acLast Me.ctlLastName.SetFocus End If End Sub Name: ctlLastName Control Source: txtLastName This is a simple routine that works in "the CornerBookstore" but for some reason I can't get the message box to appear in one of my applications. Code is as shown. Any suggestions appreciated. In article <1184449026.296013.124150@57g2000hsv.googlegroups.com>, TeeSee says... > >Private Sub Form_BeforeU...

Counting codes
An example best illustrates my problem: I have a long column of product codes, like the following 01051110 01051190 01051900 01059100 01059900 01060010 01060020 01060030 01060090 02062200 02062900 02063000 02064100 02064900 03011000 03019100 03019200 03019300 As you can see products start 01 then go to 02 then 03. In practice this continues-04,05 etc until i come to 09, then it changes to 11, 12, 13,..19 then changes again to 21, 22, 23,..29. It does this until 91, 92,...99. I wish to count the number of 2-digit products and present them in a table. For example there are, in this example...

crystal report memory error
I'm using crystal reports 9.2 to customize existing CRM report. CR was working properly. Now when i open the CR in designer mode i click on the database links i got the following error: "the instruction "0x...." referenced at memory "0xfffff..". Memory could not be "read" ". And CR exists. Please note that the report can be previewed. Your help is badly needed. Regards, Hanady is this specific to one report...if so try to save it as a different name then report. "Hanady" <hanady.abousamra@trinec.com> wrote in message ne...