ACC: Report OutputTo Text File Adds Random Blank Lines
ID: Q150501
|
The information in this article applies to:
-
Microsoft Access versions 7.0, 97
SYMPTOMS
Moderate: Requires basic macro, coding, and interoperability skills.
When you use an OutputTo action or method to save a report to an MS-DOS
Text (.txt) format, the text file adds blank lines randomly to the data.
NOTE: This behavior can also occur when you use the Save As/Export command
to save a report to a text file; in this case, the Save Formatted check
box in the Save Report <reportname> In dialog is automatically selected.
CAUSE
A text file does not have the same vertical spacing options as a report in
Microsoft Access. When you output a report to a text file, the text file
will contain 8 lines per inch. If the Height of the report's detail section
is set for a different number of lines per inch, for example 6 lines per
inch (.1667), then blank lines are added automatically.
RESOLUTION
You can avoid random blank lines when outputting a report to a text file by
setting the Height property of a report's detail section to a value
divisible by .125 inches. For example, if the detail section's Height
property contains a fractional number, set the fractional portion of this
property value to one of the following decimal equivalents:
Fraction Decimal Equivalent
-----------------------------
1\8 .125
1\4 .25
3\8 .375
1\2 .5
5\8 .625
3\4 .75
7\8 .875
When the height of the detail section is divisible by .125 inches, the
spacing is consistent (without extra, random blank lines) because the data
from the report is output at 8 lines per inch.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new, blank report based on the Employees table in the sample
database Northwind.mdb and open it in Design view.
- Add a text box to the detail section and set the following properties:
Label:
Caption: LastName:
Left: 1"
Top: 0"
Width: 1"
Height: .1667"
Text Box:
ControlSource: LastName
Left: 2"
Top: 0"
Width: 2"
Height: .1667"
- Select the detail section and set its Height property to .1667" (the
same height as the LastName control).
- Close and save the report as Report1.
- Press CTRL+G to display the Debug Window.
- Type the following line and press ENTER:
DoCmd.OutputTo acReport, "Report1", acFormatTXT, "Report1.txt", True
NOTE: When the Report1.txt file displays in a text editor, you will see
several random blank lines in the data, for example:
Last Name: Davolio
Last Name: Fuller
Last Name: Leverling
Last Name: Peacock
Last Name: Buchanan
Last Name: Suyama
Last Name: King
Last Name: Callahan
Last Name: Dodsworth
REFERENCES
For more information about outputting a report to a text file, search the
Help Index for "OutputTo," or ask the Microsoft Access 97 Office Assistant.
Keywords : kbusage OtpTxt
Version : 7.0 97
Platform : WINDOWS
Issue type : kbprb