473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

When Generating Report don't show columns which are empty

101 100+
Hi,
>I have project in MS access.
>In that project I am generating some reports for my company.
>Now In my form I have one combobox(PalletNo_combo)
>when I select an item from combobox and then click on search button then it will generate Report on search criteria.
>Now in that report I have 15-20 fields like
PalletNo,OrderDate,CustmerCode,ShippingLocation,Ca rtons,PartialCartons,ShippedDate,TotalQuantity,Shi ppedQuantity etc
>Now when Report gnerated I have column PartialCarton which is empty sometimes bcz of Null value inside it.
>So I don't want to show it in report when whole column in empty or value is Null.
>If anyone have solution plz help me.
Thanks
Dec 10 '07 #1
3 4244
MMcCarthy
14,534 Expert Mod 8TB
Hi,
>I have project in MS access.
>In that project I am generating some reports for my company.
>Now In my form I have one combobox(PalletNo_combo)
>when I select an item from combobox and then click on search button then it will generate Report on search criteria.
>Now in that report I have 15-20 fields like
PalletNo,OrderDate,CustmerCode,ShippingLocation,Ca rtons,PartialCartons,ShippedDate,TotalQuantity,Shi ppedQuantity etc
>Now when Report gnerated I have column PartialCarton which is empty sometimes bcz of Null value inside it.
>So I don't want to show it in report when whole column in empty or value is Null.
>If anyone have solution plz help me.
Thanks
The simple answer is you can't.

If a column is defined on a report you can't hide it if the value is null/empty for all values.
Jan 8 '08 #2
Minion
108 Expert 100+
What mmccarthy said is right from what I can tell, however there is a way to fudge it a little. WARNING: The following is not pretty and expects you know a little about coding and recordsets. Also depending on how many records there are in the report and the computing environment it may take a very long time to open.

Now as I was saying you can fudge it a little by putting a counter code into the open event of the report. This will need to open a recordset that is the same source of the report be it a table or a query. Then the particular record within the record set will need to be counted (generally this will be the column number counting from 0). Once counted we can do a simple "IF" to see if the counter is empty and then hide the label for the column on the report. This will leave a blank column unless you put it at the end of the report or you take the pains to code in a formatting block in the IF statement that will rearrange the report.

I'm sure there will be questions so I'll try and help as much as possible and am sure the experts here will be of more help with some of the more difficult parts.

Expand|Select|Wrap|Line Numbers
  1. Dim rst as RecordSet
  2. Dim i as Integer
  3.  
  4.  
  5. set rst = <<code to open recordset here>>
  6. i = 0
  7.  
  8.    While Not rst.EOF
  9.       If Not (isNull(rst.fields(<<field number.. again column number counting from 0>>))) Then
  10.          i = i + 1
  11.       End If
  12.    Wend
  13.  
  14.    If i = 0 Then
  15.       Me.Label.Visible = False
  16.    End If
  17.  
I hope this helps or at least gets you moving in the right direction. Again I will attempt to clear things up as questions arrise.

- Minion -
Jan 8 '08 #3
MMcCarthy
14,534 Expert Mod 8TB
What mmccarthy said is right from what I can tell, however there is a way to fudge it a little.
>
>
I hope this helps or at least gets you moving in the right direction. Again I will attempt to clear things up as questions arrise.

- Minion -
Nice solution Minion.

The only other thing I can think of suggesting is to use Dynamic Reporting of some kind.

There's an article on it here.

Create Dynamic Report using VBA
Jan 8 '08 #4

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

Similar topics

4
by: Racer-D | last post by:
When some of the SQL Server stored procedures I have written are called via my Classic ASP page I have written I get the following error in the cell that is supposed to be retrieving a single...
0
by: Ali Eghtebas | last post by:
Hi, I tried this demo application in here (watch for any line breaks in the URL): (http://support.crystaldecisions.com/communityCS/FilesAndUpdates/vbnet_win_a dodotnet.exe.asp When exporting...
2
by: DFS | last post by:
Main report contains one large graph in the detail band (no detail records). Subreport snakes just fine (5 columns) when opening by itself. When I add it to the main report (in the report...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
1
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own...
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
2
by: Screaming Eagles 101 | last post by:
And if it's possible, how can I do this please ? -- Filip http://www.ww2airborne.net/ Official Site of the 101st Airborne - 463rd PFA skype: airborne463pfa-fiwi ...
10
by: sara | last post by:
Hi - I have a report that is 14 columnar sub-reports (Line up: Position- holders in each of our 14 locations - Manager, Assistant Manager, Receiving, Office, etc). I output directly to PDF...
1
by: alhomam | last post by:
hi all i have a table with many columns and i need to create a report that the user can select the columns he needs to show in the report. is it possible? thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.