Report Title

W

Walt

Hi,

Can anyone tell me how can I have a search word show up as the title of my
report?

I have a form with a drop down list and a text box that allows a person to
conduct a keyword search against the items in the list and the results are
displayed as a report. What I want to do is have the title of the report be
the keyword that they used to perform the search.

Thank you
 
P

Philip Herlihy

Walt said:
Hi,

Can anyone tell me how can I have a search word show up as the title of my
report?

I have a form with a drop down list and a text box that allows a person to
conduct a keyword search against the items in the list and the results are
displayed as a report. What I want to do is have the title of the report be
the keyword that they used to perform the search.

Thank you

Assuming that the title is a label control, you can set the "Caption"
property to a string. You could put some code in the report's OnOpen
event handler to copy the current value of the relevant control on the
launch form. This page has helpful explanations of how to refer to
controls on forms:

http://www.mvps.org/access/forms/frm0031.htm

... or you could play around with the Expression Builder which can help
you identify how to refer to objects like this.

Phil, London
 
A

Armen Stein

Can anyone tell me how can I have a search word show up as the title of my
report?

Yes, on your report use a control source something like:

=Forms!MyForm!MySearchText

or

="The search text for this report is " & Forms!MyForm!MySearchText

This assumes that the form is still open.

There's a similar technique in this example I've posted:
www.JStreetTech.com/downloads - see "Report Selection Techniques".

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
K

ken

Another way is to pass the value to the report as its OpenArgs
property e.g.

DoCmd.OpenReport "MyReport", _
View:=acViewPreview, _
WhereCondition:= "MyField " = & Me.cboMyCombo, _
OpenArgs:=Me.cboMyCombo

' close this form
DoCmd.Close acForm, Me.Name

In the report's Open event procedure assign the value to an unbound
text box control in the report header section:

Me.txtTitle = Me.OpenArgs

The advantage of this over referencing the form from within the
report's module is that it allows you to close the dialogue from which
the report is opened, as in the above example.

Ken Sheridan
Stafford, England
 

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

Top