The information in this article applies to:
- Microsoft Access version 7.0
   
 SYMPTOMS
 
Moderate: Requires basic macro, coding, and interoperability skills.
 
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.
  
 MORE INFORMATION
 
When Microsoft Access outputs data to an RTF file, it uses the first data
record to determine the format for that section. If a control in the first
record is underlined, that control is underlined for all subsequent records
in the RTF file. Microsoft Access ignores any format changes after the
first record.
 
 Steps to Reproduce Behavior
 
- Open the sample database Northwind.mdb.
 - Make a copy of the Employee Sales By Country report and name it
   Rtf_Test.
 - Open the Rtf_Test report in Design view.
 - 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!SaleAmount.FontUnderline = True
      Else
        Me!SaleAmount.FontUnderline = False
      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 sales amounts for which the sales total 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 Rtf_Test.RTF in a word processor (such as Microsoft Word for
   Windows) that supports the RTF format. Note that the sales amounts
   are not 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.
 
 Keywords          : IntpOthr kbinterop PgmHowTo
Version           : 7.0
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbprb
Solution Type     : kbworkaround 
	
	 |