Auto Title My Report

fraser_lindsay

Access wannabe
Local time
Today, 23:12
Joined
Sep 7, 2005
Messages
218
Hello,

I have been producing some reports with my new found 'query by form' skills. Thanks to everyone for helping me out with that.

I would like to be able to add some sort of title automatically based on the parameters chosen on my QBF search form.

Can anyone tell me how to do this or post a small bit of example code that I could use?

Thanks
 
Private Sub Report_Open(Cancel As Integer)
Me.Caption = "your title here"
End Sub

OR

Put an "unbound Text Box at the top of the report and use the following code

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ReportName = "your title here"
End Sub

You could also use ...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ReportName = strReportTitle
End Sub

... where strTitle is a Public Variable from elsewhere.
 
ted.martin said:
Private Sub Report_Open(Cancel As Integer)
Me.Caption = "your title here"
End Sub

OR

Put an "unbound Text Box at the top of the report and use the following code

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ReportName = "your title here"
End Sub

You could also use ...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ReportName = strReportTitle
End Sub

... where strTitle is a Public Variable from elsewhere.


Thanks for this.

I'm not having much luck with this simple task. Where is my reference from the code to my unbound text object?

Also - does this code actually generate the title based on the parameters I have chosen in my query form? I only have one report template that my QBF loads, but I need the reports to be indentifiable by what was actually searched for.
 
The way I've achieved this in the past is to have hidden controls on the search form identifying what the user has chosen in the combo box =[Cboboxname].Column(1)

In the report itself reference the value in the form

=Forms!FrmName!ControlName

There are probably other ways but this worked well for me and there is a sample in the thread I pointed you to on the last occasion. In the search form you will find it if you unhide the hidden controls.

This will give you the options chosen by the user but upon re-reading your question this may not be what you are looking for! Sorry if I mis-understood your question

Hay
 
Last edited:
The of the content of the variable can be sourced from a text field on a form .... (event code) strReportTitle = [Textfieldname].Text

and this same text field can then be used in the criteria of your query eg. [Forms]![FormName].[Textfieldname]

You haven't said where you query criteria come from but I have assumed that there is some kind of selction process on a form.
 
Yes, I currently select my criteria using a series of combo boxes on a form. I had overlooked the fact that I might need to actually identify what criteria the report referred to once printed out.

Your replies sound good. I'll give this a go today.

Thanks very much for your help.
 

Users who are viewing this thread

Back
Top Bottom