Adding Comments In Report Footer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report ,in which some records may have a comments field.
Is it possible to have this comments field displayed at the report
footer,only for the records having commets.
Bassel
 
Yes. You could use a subreport that selects the comments field where the
comments field is not null.
 
Well, a report footer prints at the end of a report (thus the name). If you
have fifty records in your report and half of them have comments do you
print them in the footer or not? If so, which record would you pull the
comment from?

You could use group footers (if you only have one piece of detail in each
group), page footers (if you only have one piece of detail per page), or
simply include the data in your detail record.
 
I added a subreport, but if I used Link Master and Child fields no data
appears.
If I leave Link Master and child field blank, comments for all records in
databse will appear.
I only want the comments field for data records displayed in each page of
the report.
 
Don't link master/child.
Limit your records like you limit the records in your main report or find
some other method.

You state Report Footer, not Page Footer. I wouldn't spend the time
attempting to do this for Page Footers. Group or Report Footers are easier.
 
Sorry I meant page footer. I want the comments to appear for records
displayed only in each page of the report.
 
Are groups defined on each page or is the page breaking at arbitrary
records?

Do you understand code? I expect you could create a global variable in the
report and set it to "" in the page header and then concatenate text to the
variable and display it in the page footer.
 
Assuming you have a text box in the detail section named "txtComments" and a
control source of your comments field. Also, text box in the Page Footer
section named "txtPageComments" with no control source.

Add code to your report:

Option Compare Database
Option Explicit
Dim strComments As String

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then
strComments = strComments & " " & Me.txtComments
End If
End Sub

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.txtPageComments = strComments
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
strComments = ""
End Sub
 
Thank you Duane.
It worked fine.

Duane Hookom said:
Assuming you have a text box in the detail section named "txtComments" and a
control source of your comments field. Also, text box in the Page Footer
section named "txtPageComments" with no control source.

Add code to your report:

Option Compare Database
Option Explicit
Dim strComments As String

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount = 1 Then
strComments = strComments & " " & Me.txtComments
End If
End Sub

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)
Me.txtPageComments = strComments
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
strComments = ""
End Sub
 
Back
Top