473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When Generating Report don't show columns which are empty

101 New Member
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(Pallet No_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,OrderD ate,CustmerCode ,ShippingLocati on,Cartons,Part ialCartons,Ship pedDate,TotalQu antity,ShippedQ uantity 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 4257
MMcCarthy
14,534 Recognized Expert Moderator MVP
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(Pallet No_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,OrderD ate,CustmerCode ,ShippingLocati on,Cartons,Part ialCartons,Ship pedDate,TotalQu antity,ShippedQ uantity 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 Recognized Expert New Member
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 Recognized Expert Moderator MVP
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
2794
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 result: "ADODB.Recordset error '800a0cc1' Item cannot be found in the collection corresponding to the requested name or ordinal. /Default.asp,...
0
3564
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 to Excel there is an empty column after each actual column in the excel. Why? Is this a normal behaviour? Is it impossible to get rid of the empty...
2
2847
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 footer), it shows just 1 column and spills over to 5 pages. I've tried moving the subreport to the detail band: no go. All bands/objects are set to...
15
4389
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 of students and columns of activities and the data are the students' scores in each activity. No problem, almost. The problem is that there are...
1
5155
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 column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
4
4217
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 relative textbox, depending on value? (2)
2
2858
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
2113
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 (using ConvertReportToPDF from this site - Stephan Lebans) The formatting - Outlines on some fields - do not appear on subreports
1
6192
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
7609
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
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
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...
0
6278
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
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
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
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.