ACC95: Cannot Export Run-Time Font Style Changes to RTF (141105)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
This article was previously published under Q141105 Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you conditionally set the font styles for a report's controls using a
section's OnFormat property, the changes are lost when you choose the
Save As/Export command to save the report as a Rich Text Format (RFT) file.
For example, if you change a control's FontUnderline, FontItalics, or
FontWeight property at run time, the change does not appear when you output
the report to an RTF file.
RESOLUTION
To work around this behavior, you can use the following steps to stack two
bound controls (one with font styles and one without font styles) on each
other and set the Visible property to specify which control is displayed
at run time:
- Open the sample database Northwind.mdb, and make a copy of the Employee Sales By Country report. Name it Rtf_Fix.
- Open the Rtf_Fix report in Design view. If the field list is not
displayed, click Field List on the View menu. Drag the SaleAmount field
from the field list so that it is on top of the existing SaleAmount
control in the detail section. Change the Name property of the control
to Rtf_Sale.
- Delete the label associated with the Rtf_Sale control, and then set the following properties for the Rtf_Sale control:
Format: Currency
BorderStyle: Transparent
FontUnderline: Yes
NOTE: This example sets only the FontUnderline property. To set the
FontItalics or FontWeight property, you would need to set those
properties also.
- Set the detail section's OnFormat property to the following event
procedure:
Private Sub Detail_Format (Cancel as Integer, FormatCount as _
Integer)
If Me!SalespersonTotal > 5000 Then
Me!RTF_Sale.visible = True
Me!SaleAmount.visible = False
Else
Me!RTF_Sale.visible = False
Me!SaleAmount.visible = True
End If
End Sub
- On the File menu, click Print Preview. When you are prompted for a
beginning and ending date, enter 01/01/95 and 01/20/95, respectively.
Note that the sales amounts for which the total sales is greater than
$5,000 are underlined.
- On the File menu, click Save As/Export.
- In the Save As dialog box, click to select "To an external File or
Database," and then click OK.
- In the Save Table dialog box, under Save As Type, select Rich Text
Format (*.rtf), and then click Export.
- Open the Rtf_Fix.Rtf file in a word processor (such as Microsoft Word
for Windows) that supports the RTF format. Note that the sales amounts
for which the total sales is greater than $5,000 are underlined.
REFERENCES
For more information about the Save As/Export option, search on the phrase
"exporting data to another file format" using the Microsoft Access 7.0
Help Index.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbinterop kbprb kbProgramming KB141105 |
---|
|