Solved

Conditional Formatting of Access 2007 Report Header

Posted on 2014-01-29
2
608 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

Technology Partners: 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

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…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

735 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