Automate the Report's Title

A

Andy

In the post "Ask for Criteria" an MVP included a link to:
Martin Green's site <http://www.fontstuff.com/access/index.htm>.

From that page there is a link to:
<http://www.fontstuff.com/access/acctut19.htm>
which includes exactly what is needed for this database.

"Automate the Report's Title
Most reports need some sort of descriptive title and you might like the
title to change to reflect the records displayed."

He gives this example:
"For each title you need to place an empty control in the report's Report
Header or Report Footer section."
"The text of your title can be made up of plain text ..."
With Reports![rptStaff]
..Filter = strFilter
..FilterOn = True
..txtReportTitle.Value = _
"Staffing Report - " & Format(Date, "dd mmm yyyy")
End With

He doesn't say where in the sequence the "With" should be placed.

Have tried, among a few dozen other combinations::
Private Sub cmdUnitsOnOrder_Click()

Dim strCriteria As String
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
strCriteria = "[UnitsOnOrder] > 0"

Msg = MsgBox("Do You want to preview the ''Items Ordered'' report
before printing?", vbYesNoCancel)
Select Case Msg
Case vbYes
DoCmd.OpenReport "rptInventory", acPreview, , strCriteria

With Reports![rptInventory]
' .Filter = strFilter
' .FilterOn = True
..txtReportTitle.Value = "Items Ordered Report - " &
Format(Date, "dd mmm yyyy")
End With

Where would the "With.Reports" be placed?

Andy
 
A

Andy

Note: Using the code below opens the report but does not display the text in
the unbound control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top