Publish Report to Word - computed textbox value doesn't show

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report with a text field whose value is computed by a VB macro. It looks fine when I preview the report in Access, but when I click the "Publish with MS Word" button, the field is empty.

Any ideas?

Jeri
 
FYI, if the macro that computes the value puts it in a label field instead of a textbox field, the value *does*appear in the report when I publish it to Word. However, because the computed value is a text string whose length can vary, the field in which it is displayed needs to be able to grow as the length of the text grows. That works for a textbox field, but not a label field.

Jeri
 
Can you use a function to compute so the value can be included in the query?

--
Duane Hookom
Microsoft Access MVP
Please direct any questions to News Groups


Jeri Morris said:
FYI, if the macro that computes the value puts it in a label field instead
of a textbox field, the value *does*appear in the report when I publish it
to Word. However, because the computed value is a text string whose length
can vary, the field in which it is displayed needs to be able to grow as the
length of the text grows. That works for a textbox field, but not a label
field.
 
I can't imagine a macro doing something that a function can't do in a query.

--
Duane Hookom
MS Access MVP


Jeri Morris said:
the query?

Unfortunately, no. The computation is way too complex.

Actually, the "computation" is a set of string substitutions. The code
scans a string taken from the database for certain tags, and replaces the
tags with data from various tables in the database, and uses the resulting
string in the report. For example, if the string in the database is:
"Student <!StudentName>, living at <!StudentAddress>, paid <!Tuition> in tuition."

the code might replace that with:

"Student John Doe, living at 1 Park Plaza, New York, NY, paid $10,000 in tuition."

Since I can't predict what the string containing the tags will look like
(the user is allowed to change it), the code has to fetch it from the
database, do the tag substitution, then display the result in the report.
I was modifying a report created by someone else when I posted my message.
The original report used hard-coded text. I changed it to pull the text from
a table instead (without adding the complexity of the string substitution
yet), but then ran into the problem I described earlier when I tried to
export the report to Word. However, when I created a new report from scratch
and set it up the same way as the original report (or so I think), I
*didn't* have a problem exporting the report to Word--all the text shows up.
Given that the two reports behave differently when exported to Word, there
must be some difference betwen the original report and the new one that I
can't see (yet). Any thoughts on what that difference might be?
 
Back
Top