Using variables in report lables???

G

Gary Davidson

Hi all, don't know how this can be done but there must be a way.

I would like a lable on my report that includes the criteria used to
build the report.

I have two variables defined in my code, VarRegionID and VarSiteID.
What I would like is a lable which uses these and looks like my
example below.

Site History Report for 'VarRegionID' 'VarSiteID'

How can I do this?

Thanks all

Gary
 
A

Allen Browne

How does the report actually get values for varRegionID and varSiteID?

If they are parameters in the query the report is based on, you could just
use a text box with Control Source of:
="Site History Report for '" & [varRegionID] & "' '" & [varSiteID] & "'"

If you filtered the report by applying a WhereCondition to the OpenReport
action, you don't have the individual values, but you can display the Filter
on the report by setting the Control Source of a text box to exactly this:
=[Report].[Filter]

If you want a more involved approach, you could programmatically build up a
description of the filter in a string variable at the same time as you
construct the WhereCondition string. Then pass this string to the report. In
Access 2002 or 2003 you can pass it via the OpenArgs argument of OpenReport,
and display it with:
=[Report].[OpenArgs]
With earlier versions you have to use a public string variable, read it in
the Format event of the Report Header section, and assign the value to an
unbound text box on the report.
 

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