Using data with labels

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

Is it possible to use data in the labels with an Access report? For
instance, I have a report that the heading says, "Weekly Expense Reporting
for", would it be possible to add some data to this string to make it,
"Weekly Expense Reporting for & CliFName + " " CliLName". And CliFName and
CliLName are inserted on runtime? Instead of using 2 different labels,
which makes the spacing weird.

Thanks,
Drew Laing
 
Drew said:
Is it possible to use data in the labels with an Access report? For instance,
I have a report that the heading says, "Weekly Expense Reporting for", would
it be possible to add some data to this string to make it, "Weekly Expense
Reporting for & CliFName + " " CliLName". And CliFName and CliLName are
inserted on runtime? Instead of using 2 different labels, which makes the
spacing weird.

Me.LabelName.Caption = "Weekly Expense Reporting for " & CliFName & " " CliLName

Run this in the Open event of the Report or in the Format event of the section
where the label resides. Of course, you could just use an unbound TextBox
instead of a label and then put the expression directly in the ControlSource.
 
Use a text box (not a label), and set the Control Source to:
="Weekly Expense Reporting for " & [CliFName] + " " & [CliLName]

You may need to change the Name property of the text box as well. Because it
is bound to an expression, it must not be CliFName, CliLName, or the same as
any other field in the report's RecordSource.
 
Thanks!

Drew

Allen Browne said:
Use a text box (not a label), and set the Control Source to:
="Weekly Expense Reporting for " & [CliFName] + " " & [CliLName]

You may need to change the Name property of the text box as well. Because
it is bound to an expression, it must not be CliFName, CliLName, or the
same as any other field in the report's RecordSource.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Drew said:
Is it possible to use data in the labels with an Access report? For
instance, I have a report that the heading says, "Weekly Expense
Reporting for", would it be possible to add some data to this string to
make it, "Weekly Expense Reporting for & CliFName + " " CliLName". And
CliFName and CliLName are inserted on runtime? Instead of using 2
different labels, which makes the spacing weird.

Thanks,
Drew Laing
 
Drew

One approach would be to make that "label" a textbox instead. That way, you
can use a formula in the textbox's Control Source property, something like:

="Weekly Expense ... for " & [CliLName]

This assumes you are already bringing [CliLName] via the query that
underlies the report.

If you are using a "report order" form, and selecting the client there,
you'd need to refer to the control on the form, something like:

="Weekly ... for " & Forms!YourFormName!YourControlName

(actual syntax may vary).
 
Back
Top