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

Show group footer only when needed? 1

Status
Not open for further replies.

eowyn12

IS-IT--Management
Sep 23, 2002
10
US
Hi,
I have a report with a department footer with sums for dept 1, 2 & 3. Users want to add a sub total of dept 1 & 2 after dept 2 group footer. I added a DeptKind field in department code table, and set DeptKind of dept 1 & 2 as A, and DeptKind of dept3 as B.
Now I set a group footer of DeptKind and it sums 1 & 2 as expected, but of course, it will show up after dept3 as well.
Is there anyway to show group footer only when DeptKind=A?
When I put code in OnPrint of the group footer (if me.deptkind="A" then me.groupfooter.visible=false), it worked on screen, but all of the group footer disappears when printed.
Any suggestions would be highly appreciated!
Thanks!

Yoko
 
Yoko
You indicate that you want the Group Footer to show only when DeptKind = A

But your code you have made is set to have the Group Footer invisible when DeptKind = A
If me.deptkind="A" then me.groupfooter.visible=false

Shouldn't it be
If me.deptkind="A" then me.groupfooter.visible=TRUE

Also, try putting the code on the OnFormat event rather than on the OnPrint event.

Tom
 
Hi Yoko
Here is another possiblity:
Code:
Dim iCount
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
iCount = iCount + 1
If iCount = 4 Then
    Me.GroupFooter1.Visible = False
End If
End Sub
 
Thank you, Tom.
I put the correct code in OnFomrat, added "Else" condition, then it worked! (without "Else", it didn't).
My final code looks like this;

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
If Me.txtDeptType = A Then
Me.GroupFooter1.Visible = True
Else
Me.GroupFooter1.Visible = False
End If

End Sub

Thank you again!

Yoko
 
Thank you for your resopnse, Remou.
I didn't see your thread when I posted the above message...
Your suggestion worked as well, when I added the "Else" structure.
I will stick with my solution for now, but I think I can use your "icount=icount+1" idea in many ways.
Thank you again!
Yoko
 
Yoko
I agree that Tom's solution is much better, that's why I gave him a star ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top