Solved

Conditional Formatting of Access 2007 Report Header

Posted on 2014-01-29
2
583 Views
Last Modified: 2014-02-03
I am trying to apply a OnFormat condition to a low level report header.  Basically, if the header field does not have a value, I want to suppress display of all the header fields.  The Onload code is:
Private Sub GroupHeader4_Format(Cancel As Integer, FormatCount As Integer)
If (Len(Nz(Me.CAUS_ID, "")) > 0) Then Me.GroupHeader4.Visible = False
   ' If IsNull(Me.CAUS_ID) Then Me.GroupHeader4.Visible = False
  ' If IsEmpty(Me.CAUS_ID) Then Me.GroupHeader4.Visible = False
End Sub
The GroupHeader4 and fields still display.  Note from the commented code that I have tried several ways to detect a null field value, but to no avail.

This is a very large report and there are only about 10% of the records with a CAUS_ID that would have additional data.  Attached is a sample of what the report looks like.

Appreciate any help!

Al
0
Comment
Question by:alvoninfl
2 Comments
 
LVL 20

Accepted Solution

by:
GrahamMandeno earned 500 total points
Comment Utility
Hello Al

If you want to suppress the printing of the entire header section, then set the Cancel argument to True:

If IsNull(Me.CAUS_ID) Then Cancel = True

If it is possible that Me.CAUS_ID contains a zero-length string (ZLS) rather than a Null, then use this:

If Len( Me.CAUS_ID & "" ) = 0 Then Cancel = True

Best wishes,
Graham Mandeno [Access MVP 1996-2014]
0
 

Author Closing Comment

by:alvoninfl
Comment Utility
Graham:

I used the second formula and that worked.  Thanks much!

Al
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now