Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skip Printing a Line When a Column Value Is Null 2

Status
Not open for further replies.

elinsd

Programmer
Oct 22, 2002
32
US
Hi,
I have an Access Project (.adp) report that prints out text that show hierarchical data from a stored procedure. What I want to achieve is to print out all lines of data except the null ones which are being printed as blank lines. The null records have to be there in the query for the underneath data to be displayed but I'd like to skip the null records when printing because the blank lines look ugly and unexplained.
I've tried setting the detail section's "In Print" or "In Format" properties to make the null data invisible but it didn't work for my purpose. The stuff I found online haven't been able to solve my problem. So please if anybody can help.
 
In the On Format event of your detail section put code like this:
Code:
If IsNull([YourNullField]) Then
   Cancel = True
End If
This will cancel the printing of a detail line if the specified field(s) are null......
 
Thanks a lot, CosmoKramer. It worked. (I used the same code under On Print event but it didn't work.)
 
Please have a star from me for making my life easier. I managed to suppress the data I did not need.
Cheers

AK
 
Try this too (less code) in the OnFormat property of the Detail section.

Detail.Visible = Not IsNull(YourField)

This will only make visible detail lines where the specified field isn't null. Jessica Morgan
Fire Fighter Sales & Service Co.
Pittsburgh, PA
 
Jussica

Thank you once again for your further help. I actually modified the code to exclude a category of records (not just null record) from being printed which works very well. I will hang on to your additional code for future sake. Can I ask you a question though, is it possible to perform calculation in a report footer so that total number of records in the detail section are counted but trick is this count should combine a total from another set of count I am getting from a dcount function in one of my header. So in nutshell, I need to be able to add result of counting done in a header as well as in the footer. The structure of my report is as under:

Region (overall grouping) where dcount function counts records meeting ceretain development status criteria)

Development Status (Second level of grouping)where I have records listed by all other variations of development status excluding the one used in the dcount function above.

In the footer, I would like to add number of records in the first (dcount function) and second group levels to give me a sum total of records. Am I supposed to be using names given to calculated fields? Will appreciate a little help on this.



Cheers

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top