INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Conditional Formatting - Multiple Group Headers

Conditional Formatting - Multiple Group Headers

(OP)
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 --> VBA

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.

RE: Conditional Formatting - Multiple Group Headers

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 --> VBA

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

RE: Conditional Formatting - Multiple Group Headers

How are ya abaird03 . . .

Quote (abaird03)

... I am unable to figure out how to suppress only the sections the lack information. ...

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

CODE

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

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

Your Thoughts? . . .

See Ya . . .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer? Worthy Reading! thumbsup2

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close