Solved

Conditional Formatting of Access 2007 Report Header

Posted on 2014-01-29
2
587 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
ID: 39819719
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
ID: 39829326
Graham:

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

Al
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

947 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

22 Experts available now in Live!

Get 1:1 Help Now