Displaying the text in the report header based on selected criteri

G

Guest

Hi all, (and Hi Brendan)
I want to display the label text in the report header section based on the
selected search criteria in the form like say - If I am generating a report
based on the received_date, I want the label text in the Header section to
be-
"Report based on Received Date : 2/5/2006" . (whatever date I mention)
Similarly if I am generating a report based on an Employee,I want it to be-
"Report based on Employee : Anand Vaidya" . (whatever Employee I select)
 
D

Duane Hookom

You might want to tell us where you get "(whatever Employee I select)" and
"selected search criteria in the form".

If the form is open, you can generally use a control source of a text box
like:
="Report based on ...." & Forms!frmYourForm!txtRecvdDate
 
G

Guest

Duane,I open the same report(ie report with the same fields) for all the
search criteria.Only difference is that records are displayed(filtered) based
on the selected criteria in the form.Now how can I use
="Report based on ...." & Forms!frmYourForm!txtRecvdDate
as the control source because I may be using different search criteria
fields as-
for employee - cboEmployee
for received date - txtReceivedDate and so on.


-------------
Anand Vaidya
I'm here to know.


Duane Hookom said:
You might want to tell us where you get "(whatever Employee I select)" and
"selected search criteria in the form".

If the form is open, you can generally use a control source of a text box
like:
="Report based on ...." & Forms!frmYourForm!txtRecvdDate
 
D

Duane Hookom

I'm not sure I understand your question.
Bottom-line: you can create expressions in control sources on your report
that reference values in controls on forms.

="Report dates: " & Forms!frmA!txtStart & " through " & Forms!frmA!txtEnd &
" AND Employee: " & Forms!frmA!cboEmployee

--
Duane Hookom
MS Access MVP
--

Anand Vaidya said:
Duane,I open the same report(ie report with the same fields) for all the
search criteria.Only difference is that records are displayed(filtered)
based
on the selected criteria in the form.Now how can I use
="Report based on ...." & Forms!frmYourForm!txtRecvdDate
as the control source because I may be using different search criteria
fields as-
for employee - cboEmployee
for received date - txtReceivedDate and so on.
 
G

Guest

I generate reports based on calender days all the time. Once the date range
is filled into the form I use a command button to open my report. The
reports contain Text Boxes. For the control source for the text boxes you
want to use to display the data, choose "BUILD and then point to your form
and then the text boxes that hold the information you filled into the form
that you want to display on your report.
 
G

Guest

Sorry, I could not put the question clearly.Ok let me put the whole thing
very clear so that I would not trouble you further making guesses as to what
I want.
Some details before proceeding further-
main form - frmReport
sub form - SubContainer
rptSearchedRecords - report
qrySearchedRecords - query string
I have 4 labels(Received date,Employee,Status and CustomQuery) and a
"Generate Report" button on the main form.The CustomQuery was added later as
my senior wanted me to have an option where I could use any/all of the
combination of the search criteria(ie Received Date,Employee,Status).
When I click ,say,Custom Query on the main form,I get all the search
criteria controls ( Received Date, Employee,Status ) in the subform.Similarly
when I click Employee in the main form , I get concerned controls(fields) in
the subform.
I am building the query string based on the selected controls(fields) and
generating a report using docmd.openreport() function.There is "only one"
report for all the search criteria(ie the same report(with same fields) is
opened for every search criteria but the records displayed would be different
based on the criteria selected.)
Now, my requirement is I want to have a title on the header section of the
report based on the search criteria I selected in the subform. say , if I
selected Employee as the search criteria in the form , I want the title in
the header section on the report to be-
"Report based on Employee : Anand Vaidya"
Similarly if I select Status as the search criteria then
"Report based on Status : Open"
I hope I am very clear this time and hence hope I would get what I want.
 
D

Duane Hookom

Apparently you have code that builds a where clause for the DoCmd.OpenReport
method. One solution would be to create an invisible text box on your form
and stuff it with your text as you build your where clause. Then, in the
report, add a text box that references the text box:

=Forms!frmReport!txtReportTitle
 

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