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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting - Multiple Group Headers

Status
Not open for further replies.

abaird03

Technical User
Sep 25, 2013
1
US
Hello. I am currently utilizing Microsoft Access 2007. The report I am attempting to create has certain sections that would lack information. Each of these individual sections exist in differing Groupings on the report. My problem is arising in the fact that I am unable to figure out how to suppress only the sections the lack information. I have attempted to add coding to the On_Format sections of GroupHeader2 and GroupHeader3. I have been unable to obtain the desired results. My current coding looks like:

Code:
Option Compare Database

Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)

Select Case Me!Number_Gallons_Fertilizer
Case Is > 0
  ' don't cancel these groups so do nothing
Case Else
  Cancel = True  'don't display other groups
   
End Select


End Sub

Private Sub GroupHeader3_Format(Cancel As Integer, FormatCount As Integer)

Select Case Me!Chemical_Name
Case Is = Null
  ' don't cancel these groups so do nothing
Case Else
  Cancel = True  'don't display other groups
   
End Select


End Sub

Any suggestions on multiple conditional formatting to differing group headers is greatly appreciated. Thank you in advance.
 
What are displayed in Number_Gallons_Fertilizer and Chemical_Name.

I usually add a text box in a group header with properties like:
Name: txtCountDetailA
Control Source: = Count(SomeField)

Then in the On Format event I use code like:

Code:
Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
  Cancel = ( Nz(Me.txtDetailA,0)  = 0 )
End Sub

Duane
Hook'D on Access
MS Access MVP
 
How are ya abaird03 . . .

abaird03 said:
[blue] ... I am unable to figure out how to suppress [purple]only the sections the lack information.[/purple] ...[/blue]

It sounds to me like you need some kind of in depth [blue]validation[/blue]. For [blue]numeric [/blue] see if the following helps:

Code:
[blue]   If IsEmpty(Me!Number_Gallons_Fertilizer) Then       [green]'Empty Variant?[/green]
      Cancel = True
   ElseIf Nz(Me!Number_Gallons_Fertilizer, 0) = 0 Then [green]'Null or Zero?[/green]
      Cancel = True
   ElseIf Not IsNumeric(Me!Number_Gallons_Fertilizer) Then [green]'Not Numeric & Not a Date & Not a NUll String[/green]
      Cancel = True
   End If[/blue]

Not sure if this is what your looking for so I'll leave it here.

[blue]Your Thoughts? . . .[/blue]

See Ya . . .

Be sure to see FAQ219-2884 Worthy Reading! [thumbsup2]
Also FAQ181-2886 Worthy Reading! [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top