Solved

Conditional Formatting of Access 2007 Report Header

Posted on 2014-01-29
2
625 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

729 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