Eliminate line break (carriage return) in report export

theKruser

Registered User.
Local time
Today, 08:57
Joined
Aug 6, 2008
Messages
122
I have a database which I am building to output html code to a .txt file for uploading to a site. The problem I face is, I cannot figure out how to force a line of text to export as continuous. As it sits, longer lines of code are forced a line break (carriage return) upon export.

As for the output, I have many text fields which I have put into queries like:

Code:
     LargeImage: '<td><a href="' & [tblLinkData.LinkAddress] & [tblBadges.LargeImage] & '" target="_blank" title="' & [tblBadges.BadgeName] & '">' & [tblBadges.BadgeName] & '</a>'
I created a report that calls this query and the resulting data looks like:

Code:
     <a href="/aaaaa/bbbbb/image.png" target="_blank" title="Badge Name">Badge Name</a>
The problem lies in the fact that when I right click the report and export as txt, the report properties (I assume) causes the results to look like:

Code:
     <a href="/aaaaa/bbbbb/image.png" target="
_blank" title="Badge Name">Badge Name</a>
for longer lines of code. This line break causes undesirable results, as you can imagine.

The goal is to update 5 different pages with info contained in the db whenever there is an update. For now, the plan is to simply export to a .txt and copy/paste into my CMS. I just have to figure out how to stop it from inserting that line break.
 

Attachments

I haven't looked at your db but can you try replacing the vbNewLine or Chr(13) with vbNullString or "" on each line you read.
 
@vbaInet

Thank you very much for your reply.

I am not very good with VBA. I assume these to be something I would have coded into the report. If they are not, I have no idea where to go to find them.
 
I've just opened your db. What do I do to replicate the problem? Which form/report and what steps?
 
rptAlphabetical. Right click and export as .txt. The first td row has a line break in it.

I may have found a way around the problem, but I still would like to understand why it is happening. If you have a moment to explain, I would appreciate it.

My work around amounted to changing the pitch to 2 and exporting to Word vice NotePad. I don't really want to do that for a long term solution because of Word's inherent problem with "correcting" code on it's own.
 
I'm not having any problems. See attached the output file.

You could try using textboxes instead of label controls.
 

Attachments

Yes, it is there. First <td> line. There is a carriage return between
Code:
Badge"
and
Code:
class=
 
I have also noticed, that in some instances, when exporting to .txt it just stops. Meaning, in the report and/or query, there is more code/text at the end of a long line of code/text than there is in the exported text. It is like the exporter just says, "Ok...too many characters in this line. I quit."
 
I would never use a report layout to export to HTML. Instead I'd do it all in code, based on a recordset.
 
Yes, it is there. First <td> line. There is a carriage return between
Code:
Badge"
and
Code:
class=

The only break I see when I open this in Notepad is that it has reached the max of the notepad application and word wraps (not breaks). So I did a test. I turned it into an html file by adding <html> and <body> around the code, as is, and opened it in a browser. It displayed exactly as it should have.
 
There you theKruser. Wise words from David.

I believe that new line is happening because the string length is too long.
 
I would never use a report layout to export to HTML. Instead I'd do it all in code, based on a recordset.

I would lov to do that, but I do not know how. Any way you could explain or post a link would help me figure it out?

Thank you for your reply!!
 
The only break I see when I open this in Notepad is that it has reached the max of the notepad application and word wraps (not breaks). So I did a test. I turned it into an html file by adding <html> and <body> around the code, as is, and opened it in a browser. It displayed exactly as it should have.

Bob-

Thank you very much for your reply. I hadn't thought about the max character limit in Notepad. However, when exported to a .doc from Access, it shows the carriage return there as well.

I wrapped in <html> and <body> tags and it did display properly, but if you look at the source from the browser, it shows this:

Code:
<tr>
     <td><a href="/aaaaaa/aaaaaa/aaaaaa/aaaa/bonnaroo_teamcoco_big.png" target="_blank" title="Team Coco Bonnaroo foursquare badge" alt="Team Coco Bonnaroo foursquare badge"><img src="/aaaaaa/aaaaaa/aaaaaa/aaaa/bonnaroo_teamcoco.png" alt="Team Coco Bonnaroo foursquare Badge" title="Team Coco Bonnaroo foursquare Badge"
     <td><a href="[URL="http://www.access-programmers.co.uk/forums/view-source:http://thekruser.com/foursquare/badges/team-coco-bonnaroo"]http://www.mysite.com/aaaaa/team-coco-bonnaroo[/URL]" title="Team Coco Bonnaroo foursquare badge on thekruser.com" alt="Team Coco Bonnaroo foursquare badge on thekruser.com">Team Coco Bonnaroo</a></td>
     <td>For checking in to the Bonnaroo Comedy Theatre at Bonnaroo Music & Arts Festival during Bonnaroo 2010.<blockquote>Congratulations! You’ve unlocked The Team Coco Bonnaroo Badge! Enjoy the show, and please consider a shower in the near future.</blockquote></td>
</tr>
Everything after 'Badge"' is deleted. I know this is a fine-point, but an important one. This is just one example. Many of my longer strings are cut off and still don't display properly.

Any insight you could give would be greatly appreciated. I do not need the report. It is just the only way I know how to export. If I could use queries to create lines of code and export them another way, I would certainly do that instead.

Thanks again for your help!
 
Last edited:
Addendum to the above:

I might actually need a report after all. I have to be able to include static code before and after the code the query generates.
 
To export to HTML in code, you open a recordset, walk the records, and output the data from the fields into a string variable with the HTML, then write the string variable to a file.

Ask for help on any step in that process.
 

Users who are viewing this thread

Back
Top Bottom