Carriage Return Causes PDF OutputTo or Sendto to go CRAZY

leblanc9425

Registered User.
Local time
Today, 08:15
Joined
May 8, 2013
Messages
22
I am completely baffled and need help troubleshooting the problem. Here is my problem:

1) I have a report with the following Rich Text Formatting:

="<head><B><U>(U) " & Trim([Title]) & "&nbsp(U)</u></B></head>&nbsp" & "</body>" & ([Description])

2) The report displays perfectly on screen however, if I try to print the single page report, it gets stuck in some kind of do loop and tries to print thousands of blank pages.

3) I believe I have narrowed down the problem to Carriage Returns. A Carriage Return anywhere in the [Description] memo field seems to cause the problem. If I remove CR, it prints fine. The [Description] field is a memo, text field in the Table but in the report it is set to Rich Text.

4) This run-away printing takes place when I try to print, and in my macro's that OutputTo or SendTo

If I do NOT use RTF in the report and keep the [Description] field as just Plain Text it seems to display and print fine but the report is not in the specific format needed.

This is what I am trying to achieve in the printed report:
(U) This is the bold underscored TITLE Field with hardcoding on either side (U) The Description portion starts immediately after the TITLE field.

Due to the problem above, I am forced to use this formatting:
(U) This is the bold underscored TITLE Field with hardcoding on either side (U)
The Description portion is not connected to the TITLE and is a separate control field.

This may seem like a minor difference, but it is what they want.

So, does anybody know why the CR would cause this problem and how do I fix it????
 
Not sure if this is a Fix, but should the no-break space character not end with a semicolon? Also your opening BODY tag is missing..
Code:
="<head> <B> <U> (U) " & Trim([Title]) & " &nbsp[COLOR=Red][B];[/B][/COLOR] (U)</U> </B> </head> &nbsp[COLOR=Red][B];[/B][/COLOR] [COLOR=Red][B]<body>[/B][/COLOR]" & ([Description]) & "</body>"
 
pr2-eugin,
Thanks for the fast response to my question/problem. I made the recommended changes to the &nbsp; which helped clean it up.


However, if I add the opening <body> before the [Description] (which I know is correct) then the carriage returns in the field are removed. So, instead of have some breaks within the paragraph, everything is run together.


I cannot explain this, but if I place the </body> before the [Description] field, then all the carraige returns (breaks) are displayed.

The good news is, that your recommendations have pointed me to another possible problem. The report is displayed on the screen fine, but if I try to Print to PDF, the I get the error: "No Current Record"

After the "No Current Record" error messages, the report is displayed properly formatted, HOWEVER, the fields from another table are displayed as #Error.

Like I said, I am completely baffled with this.
 
Okay I am a bit confused..   is a SPACE character.. If you want to break use <BR> tag.. You need the BODY tag there..

In regards with your other Error what is the code you have behind the Print button, whihc I guess is how you are printing..
 
Paul,
Sorry for any confusion. The code you provided is correct. What I was trying to show as my desired results which does not have a break.

This is what I am trying to achieve in the printed report:
(U) This is the bold underscored [TITLE] Field with hardcoding on either side (U) The [Description] portion starts immediately after the [TITLE[ field.


After some more troubleshooting, I believe the problem is with the OutputTo or SendTo AND selecting the Output Format as PDF. I removed all the tags and left just the [Description] text field in the report. If I use the exact same report, but output to RTF, it works perfectly. So, I think the problems is unique to converting the report to the PDF format.

So, let me recap:
- [Description] is a memo, Plain Text field in the table
- My report uses the [Description] field but as Rich Text Format
- I input text into [Description] using a form. Plain text.
- if the [Description] does NOT have a break or carriage return the OutputTo to PDF format works fine
- if the [Description] contains a break or carriage return, then OutputTo a PDF format fails. It tries to output 1000's of pages.

I think the OutputTo a PDF Format must be interpreting a break or carriage return in the [Description] as a blank page or something, and begins an endless print job.

I guess what I am looking for is another way (VBA) to Output a report to a PDF format to overcome this problem.

Thanks!
 
Last edited:
What I would do is store both fields as Rich Text even though you aren't using it so that the appropriate markups occur and you don't go through this hassle.
 
SOS,
Thanks for the recommendation. I will change both fields to RTF and see if I get the same error during OutputTo a PDF format.
 
Well, unfortunately, changing the field from Plain Text to Rich Text did not correct the OutputTo PDF problem. It still goes crazy if there is a blank line in the [Description]. Remove the extra line and it works fine.
 
Just a quick follow-up on what I have learned. If my [Description] field property in the report is Plain Text, the Output Format to PDF works fine. It produces a perfect PDF with separate paragraphs.

However, if I change the [Description] property in the report to Rich Text, the Output Format fails if there is a carriage return anywhere in the [Description].
Endless print job.

The only reason I was using RTF in the report was to take advantage of RTF formatting which allowed me to produce the Bold Underscore of the [Title] field but not the [Description] field. Initially I just combined the two fields in the report as:

="(U) " & [Title] & " (U)"&[Description]

The above effectively combined the two fields in the report but my only option appeared to be to Bold Underscore everything or nothing at a Plain Text property. The property does not allow to Bold Underscore just the [Title] field unless I change the property to Rich Text and add the specific tags. Unfortunately, changing to RTF for the formatting creates the endless print job if there is a carriage return in the data.

So, any ideas on a work around on how I would create a report with two fields to look like this:
(U) Bold underscored [TITLE] Field with hardcoding on either side (U) Concatenated with the [Description] field to start immediately after the [TITLE] field but without the bold and underscore.

Any suggestions?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom