Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Hard Returns from Memo Fields

Status
Not open for further replies.

Jhtexas

Technical User
Jan 4, 2005
59
US
I have a memo field in a report that I use the “Publish it with Microsoft Word” option to export the data. The paragraphs of information in the word document are not controlled by the margins but be the hard returns that are produced during this export. How do you suppress the hard returns when performing this function?

Thanks in advance,
Jim
 
what do you mean by "hard returns"? Do you mean the paragraph mark at the right-end of every line of text?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes...I do mean the paragraph mark at the right-end of the every line. I do not want them created with the memo field in the word document. They do not exist in the database data.

Thanks,
Jim
 
I just discovered this recently as well. Apparently that's what happens with the rtf converter. I tried exporting to other formats, asked a few friends, and posted on TT, but found there's no quick way around it. If this is a one-time thing and/or a small number of paragraph marks, you can just use FIND/REPLACE, and replace each one with a blank.

If you REPLACE ALL however, you will end up replacing ALL paragraph marks, even the ones you really want to keep. In my case, the MS Word report will be a daily thing, so I needed to figure a way for the user to get around it. So I did this:

1) Kept the existing MS Access report as-is. This is what the user sees when Print Previewing.

2) Created a dup of that report (this will be the one you export) and tweaked as follows (this took a bit of testing to get just right):
a) got rid of all verticle spacing between items. In MS Word this caused some paragraph "formats" of some sentences to have like "6 pt. before" to capture the blank space from my Access report.
b) I put a character alt+0149 (a bullet: you can look at the system character map to pick any other funky character you think will be safe-meaning no one will ever use it in their data) I concatenated this character every place I would want a paragraph mark to STAY in the word document. Sometimes I put two together so that a blank 'row' in the Word Doc would show up.
c) This is the report you'll export to MS Word (I use a custom toolbar which calls the specific report name). To the user when it first opens in MS Word, there are bullets everywhere. They can ignore that, and just hit the shortcut keys to run the macro.

3) Created MS Word macro by recording macros and tweaking until I finally had what I wanted: when my users hit ctrl+alt+Q, it replaces all paragraph marks with blanks, then replaces all bullets with paragraph marks.

4) I saved this macro in a special .dot file on the server where the database resides.

5) I wrote a .bat file which copies the .dot file to the user's machine (c:\program files\microsoft office\office XX\Startup). When MS Word launches, it looks here for dot files. The user sees a little pop-up window that says "Do you want to enable macros" and they hit YES.

6) on launch of the Access db, I call the .bat file (only for certain people in my case) so the .dot file gets copied to their machine. This is also good in case I change the .dot file on the server, they will always get a fresh new copy each time.

I know this might sound like a lot, but if it's something you need to automate, it works well. My toughest thing is working with MS Word macros cause they are very diff objects, but I just record macros and if I need to, post in the MS Office forum and folks will help out.

My previous posts on the topic: thread703-986966, thread68-987001)

Hope this helps.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top