473,586 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding Entire Columns in Report when value = 0

17 New Member
Hi all,

I have been searching for a couple days on this. I need to hide a column in the reports when all values within that column are "0" or blank.
Additionally if the columns that have values in them can shift so that the table does not have any spaces in between, that would be preferrable.

Things I have tried:

In the Control Source of the Text box I have input:
=IIf([WOOD_SF]="0",WOOD_SF.Vi sible="false",W OOD_SF.Visible= "true")
=IIf([WOOD_SF]="0",WOOD_SF.hi dden="true",WOO D_SF.hidden="fa lse")
I received either an "enter a parameter value" message or it would hide the whole column even if there was a value greater than 0 in on of the fields.

In the visual Basic Editor I have tried:
1.
/CODE/Private Sub Report_Open(Can cel As Integer)
If LenWOOD_SF > 0 Then
WOOD_SF.Visible = True
Else
WOOD_SF.Visible = False
End If
End Sub/CODE/
2.
/CODE/Me!WOOD_SF.Visi ble=(Me!WOOD_SF )/CODE/

I am kind of new to Visual Basic so I would prefer the easiest way possible. Working off MS ACCESS 2003, WindowsXP if that helps.

Thanks for any help you can provide.
Nov 3 '07 #1
28 6086
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hi all,

I have been searching for a couple days on this. I need to hide a column in the reports when all values within that column are "0" or blank.
Additionally if the columns that have values in them can shift so that the table does not have any spaces in between, that would be preferrable.

Things I have tried:

In the Control Source of the Text box I have input:
=IIf([WOOD_SF]="0",WOOD_SF.Vi sible="false",W OOD_SF.Visible= "true")
=IIf([WOOD_SF]="0",WOOD_SF.hi dden="true",WOO D_SF.hidden="fa lse")
I received either an "enter a parameter value" message or it would hide the whole column even if there was a value greater than 0 in on of the fields.

In the visual Basic Editor I have tried:
1.
/CODE/Private Sub Report_Open(Can cel As Integer)
If LenWOOD_SF > 0 Then
WOOD_SF.Visible = True
Else
WOOD_SF.Visible = False
End If
End Sub/CODE/
2.
/CODE/Me!WOOD_SF.Visi ble=(Me!WOOD_SF )/CODE/

I am kind of new to Visual Basic so I would prefer the easiest way possible. Working off MS ACCESS 2003, WindowsXP if that helps.

Thanks for any help you can provide.
The easiest way to accomplish what you want is to put the constraint in the query that is the record source for the report. Go to the criteria row of the column in the query grid that has the zero/null balances and put the following expression:
<>0 Or <>nz([yourColumnName],0)

Replace yourColumnName in the expression with the actual column name
Nov 3 '07 #2
tennessee
17 New Member
The easiest way to accomplish what you want is to put the constraint in the query that is the record source for the report. Go to the criteria row of the column in the query grid that has the zero/null balances and put the following expression:
<>0 Or <>nz([yourColumnName],0)

Replace yourColumnName in the expression with the actual column name

That didnt work out for me.. It took out all my values from my report. In including the column values that I want to show. What am I doing wrong?
Nov 5 '07 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
That didnt work out for me.. It took out all my values from my report. In including the column values that I want to show. What am I doing wrong?
I need more info. Please post the sql from the sql view of your query.
Nov 5 '07 #4
tennessee
17 New Member
I need more info. Please post the sql from the sql view of your query.
Here is what I got... Is this what you need?

SELECT [ESTIMATING SHEET].ID, [ESTIMATING SHEET].PLAN, [ESTIMATING SHEET].AREA, [ESTIMATING SHEET].CPT_SY, [ESTIMATING SHEET].STAIRS, [ESTIMATING SHEET].TILE_SF, [ESTIMATING SHEET].VINYL_SY, [ESTIMATING SHEET].WOOD_SF, [ESTIMATING SHEET].STONE_SF
FROM [ESTIMATING SHEET]
WHERE ((([ESTIMATING SHEET].CPT_SY)<>0 Or ([ESTIMATING SHEET].CPT_SY)<>nz([CPT_SY],0)) AND (([ESTIMATING SHEET].TILE_SF)<>0 Or ([ESTIMATING SHEET].TILE_SF)<>nz([TILE_SF],0)) AND (([ESTIMATING SHEET].VINYL_SY)<>0 Or ([ESTIMATING SHEET].VINYL_SY)<>nz([VINYL_SY],0)) AND (([ESTIMATING SHEET].WOOD_SF)<>0 Or ([ESTIMATING SHEET].WOOD_SF)<>nz([WOOD_SF],0)) AND (([ESTIMATING SHEET].STONE_SF)<>0 Or ([ESTIMATING SHEET].STONE_SF)<>nz([STONE_SF],0)));
Nov 5 '07 #5
puppydogbuddy
1,923 Recognized Expert Top Contributor
Here is what I got... Is this what you need?

SELECT [ESTIMATING SHEET].ID, [ESTIMATING SHEET].PLAN, [ESTIMATING SHEET].AREA, [ESTIMATING SHEET].CPT_SY, [ESTIMATING SHEET].STAIRS, [ESTIMATING SHEET].TILE_SF, [ESTIMATING SHEET].VINYL_SY, [ESTIMATING SHEET].WOOD_SF, [ESTIMATING SHEET].STONE_SF
FROM [ESTIMATING SHEET]
WHERE ((([ESTIMATING SHEET].CPT_SY)<>0 Or ([ESTIMATING SHEET].CPT_SY)<>nz([CPT_SY],0)) AND (([ESTIMATING SHEET].TILE_SF)<>0 Or ([ESTIMATING SHEET].TILE_SF)<>nz([TILE_SF],0)) AND (([ESTIMATING SHEET].VINYL_SY)<>0 Or ([ESTIMATING SHEET].VINYL_SY)<>nz([VINYL_SY],0)) AND (([ESTIMATING SHEET].WOOD_SF)<>0 Or ([ESTIMATING SHEET].WOOD_SF)<>nz([WOOD_SF],0)) AND (([ESTIMATING SHEET].STONE_SF)<>0 Or ([ESTIMATING SHEET].STONE_SF)<>nz([STONE_SF],0)));
OK, from the above, it looks like you are applying the criteria to multiple columns using the same criteria row. if you apply to more than one column, the criteria for the first column should go into criteria row 1, the second into criteria row 2.....and so on.
Nov 5 '07 #6
puppydogbuddy
1,923 Recognized Expert Top Contributor
also, in your case if you are only having a problem with 0 balances, you can simplify the expression to: <>0
Nov 5 '07 #7
tennessee
17 New Member
OK, from the above, it looks like you are applying the criteria to multiple columns using the same criteria row. if you apply to more than one column, the criteria for the first column should go into criteria row 1, the second into criteria row 2.....and so on.
My values on my report came back. However I am back to my original issue. The formula is not hiding the columns if the value is zero..

Here is the SQL view again..

SELECT [ESTIMATING SHEET].ID, [ESTIMATING SHEET].PLAN, [ESTIMATING SHEET].AREA, [ESTIMATING SHEET].CPT_SY, [ESTIMATING SHEET].STAIRS, [ESTIMATING SHEET].TILE_SF, [ESTIMATING SHEET].VINYL_SY, [ESTIMATING SHEET].WOOD_SF, [ESTIMATING SHEET].STONE_SF
FROM [ESTIMATING SHEET]
WHERE ((([ESTIMATING SHEET].CPT_SY)<>0 Or ([ESTIMATING SHEET].CPT_SY)<>nz([CPT_SY],0))) OR ((([ESTIMATING SHEET].TILE_SF)<>0 Or ([ESTIMATING SHEET].TILE_SF)<>nz([TILE_SF],0))) OR ((([ESTIMATING SHEET].VINYL_SY)<>0 Or ([ESTIMATING SHEET].VINYL_SY)<>nz([VINYL_SY],0))) OR ((([ESTIMATING SHEET].WOOD_SF)<>0 Or ([ESTIMATING SHEET].WOOD_SF)<>nz([WOOD_SF],0))) OR ((([ESTIMATING SHEET].STONE_SF)<>0 Or ([ESTIMATING SHEET].STONE_SF)<>nz([STONE_SF],0)));
Nov 5 '07 #8
tennessee
17 New Member
also, in your case if you are only having a problem with 0 balances, you can simplify the expression to: <>0

Tried this too and the columns in my report are still there showing zeros..
Nov 5 '07 #9
puppydogbuddy
1,923 Recognized Expert Top Contributor
My values on my report came back. However I am back to my original issue. The formula is not hiding the columns if the value is zero..

Here is the SQL view again..

SELECT [ESTIMATING SHEET].ID, [ESTIMATING SHEET].PLAN, [ESTIMATING SHEET].AREA, [ESTIMATING SHEET].CPT_SY, [ESTIMATING SHEET].STAIRS, [ESTIMATING SHEET].TILE_SF, [ESTIMATING SHEET].VINYL_SY, [ESTIMATING SHEET].WOOD_SF, [ESTIMATING SHEET].STONE_SF
FROM [ESTIMATING SHEET]
WHERE ((([ESTIMATING SHEET].CPT_SY)<>0 Or ([ESTIMATING SHEET].CPT_SY)<>nz([CPT_SY],0))) OR ((([ESTIMATING SHEET].TILE_SF)<>0 Or ([ESTIMATING SHEET].TILE_SF)<>nz([TILE_SF],0))) OR ((([ESTIMATING SHEET].VINYL_SY)<>0 Or ([ESTIMATING SHEET].VINYL_SY)<>nz([VINYL_SY],0))) OR ((([ESTIMATING SHEET].WOOD_SF)<>0 Or ([ESTIMATING SHEET].WOOD_SF)<>nz([WOOD_SF],0))) OR ((([ESTIMATING SHEET].STONE_SF)<>0 Or ([ESTIMATING SHEET].STONE_SF)<>nz([STONE_SF],0)));

Ok, lets do the following:
1. take out the nz component of the expression and simplify the expression to: <>0, then test....any change?
2. If #1 above is no change, then take out all <> 0 criteria, and start over, adding the criteria to one column at a time..and test after each column is added. Tell me what happens.
Nov 5 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2826
by: Alex | last post by:
I have a main report (single column report and page headers and footers) and a 4 column subreport in the detail section. The report will generally be a single page. Everything prints fine except that I cannot get the report footer onto the same page as the subreport, it always goes onto another page even when there is obviously room for it on...
3
2303
by: Chuck Reed | last post by:
I am working on a sales report where I show weekly sales by category for each of the 52 weeks in the year. Each record in my table/report has the 52 weeks of sales in it. I want to highlight to top five weeks of sales for each category by using a conditonal format to highlight these top five weeks. I've been trying to find a way to do this but...
0
1132
by: mpriem | last post by:
Hi, I am trying to hide a column in a datagrid I dynamicaly created, but fail to with the following code: .... .... foreach(XmlElement objStorageGroup in objServer.ChildNodes) { this.intMbSG = 0;
1
840
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called...
13
2478
by: scorpion53061 | last post by:
Very urgent and I am very close but need a little help to get me over the edge........ I need to write these columns to a html file with each row containing these columns (seperated by breaks). Currently this code write all columns to a single row which works but is not what the boss wants. If anyone has suggestions how you would do a...
22
2161
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of...
6
3022
by: Maileen | last post by:
Hi, I have a listview in report mode. I have 3 columns in this listview and 1 column i would like to hide it from user's view. i tried to give width = 0 but user is still able to resize column after in runtime mode. So, could someone help me please ? thx, Maileen
2
2894
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
Based on wether a row is selected in a GridView I need to HIDE the last two columns of a gridview. I do NOT need to make the cells invisible I want to hide the entire column. When I set the Visible property on the columns it causes the underlying ObjectDataSource to re-issue the Select statement. How can I hide these columns without...
0
1252
by: hedgracer | last post by:
I have a gridview that has six columns. I need to hide the last column (i.e. not download it) in the download from gridview to excel. My current code (which downloads the entire gridview) is as follows: public static void ExportExcelFile(Control htmlData, string filename) { HttpContext.Current.Response.Clear();...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.