Title to a report

L

Liat

Hi,

I have a form that has check-boxes for making the query
for the report. For example, one check-box is for age.
If it is with a tick, and in the fields written 10-20,
that means that the report that will be opened will be
for people in these ages.
I have more categories besides age.

I would like to change the report's title according to
the chosen categories.

How can I do that?

Thanks a lot,
Liat
 
J

Jeff Boyce

Liat

You can refer to the values in the form's controls from the report. Try
creating a text control on the report and setting it's source to something
like (actual syntax may vary):

Forms!YourQueryOrderForm!Your10-20TextBox
 
G

Guest

Thank you for your answer.

I just need the title to be changed according to the
check-boxes.

If "age" is ticked than the title should be "Report for
age 10 to 20" and if it isn't ticked, it should
be "Report" and so on
 
N

Newbie

I would generate a string in the OnFormat Event of the Report Header based
on the checkboxes that have been ticked and assign this value you an Unbound
Textbox in the Report Header

To do this I would have an option box on my form for each category with the
options All or Selection.

In the onFormat check the values of these option groups and build the string
accordingly.

Eg.

dim strTitle as String

strTitle = "Report for "

Select Case optGroupAge
case 1
strTitle = strTitle & "All Ages"
case 2
strTitle = strTitle & "Ages: " & forms!frmAgeField
End select

Select Case optGroupOther
case 1
strTitle = strTitle & "AND All Other"
case 2
strTitle = strTitle & "AND " forms!frmOtherfield
end Select

and so on . . .

me.txtTitle = strTitle

HTH
 
G

Guest

Thank you very much!!

Just one more question: in the form, one of the
categories is year which is chosen by a combo-box, that's
why the value of this field is the ID. ie, if I have
years 1970-2004 and I chose 1970, the value of this combo-
box is 1.
I would like the value to appear in the report and not
this ID. How can I do that?
 
J

John Spencer (MVP)

Refer to the column of the combobox. Columns as zero-based, so to reference the
2nd column you would use 1.

StrTitle = Forms!YourFormName!ComboboxName.Column(1)
 

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