Can you add a field in the body of a text box

  • Thread starter Thread starter FergusonH
  • Start date Start date
F

FergusonH

I'm trying to use a REPORT in Access to generate a letter. Can I have a
field display in the body of the text box? For ex: if my field is [total]
can I have something like "Our records indicate your total purchases are
[total] and your total expenses are..."

thanks!
 
The answer to your question is NO! However you can do what you want by
storing phrase in a table:
TblPhrase
PhraseID
Phrase

Where the first Phrase record is "Our records indicate your total purchases
are" and the second Phrase record is "and your total expenses are...". Then
you can do what you want with: No quotes in the actual records!
Sentence = Dlookup("[Phrase]","TblPhrase","[PhraseID = 1]") & " " &
Me![Total] & " " & Dlookup("[Phrase]","TblPhrase","[PhraseID = 2]")

Steve
(e-mail address removed)
 
FergusonH said:
I'm trying to use a REPORT in Access to generate a letter. Can I have a
field display in the body of the text box? For ex: if my field is [total]
can I have something like "Our records indicate your total purchases are
[total] and your total expenses are..."


Not sure what you are trying to accomplish, but if the
report will always have the same text in the text box, try
using an expression in the text box's control source:

="Our records indicate your total purchases are " &
[total] & " and your total expenses are..."
 
If the Total field is in the report's record source, you can create a text
box with a control source like:
="Our records indicate your total purchases are " & [total] & " and your
total expenses are..."

You may want to format the field like:
="Our records indicate your total purchases are " &
Format([total],"Currency") & " and your total expenses are..."
 
If you are working in a report in design view, you can add a text box
(unbound), then put the following in the ControlSource property of that
textbox:

="Our records indicate ... are " & [total] & " and your total expenses
.... " & ...

Note that you will need to have the fields from a table or a query
(preferable) so Access can 'find' the value for [total] and any other fields
you embed in that string.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top