Problem with textfile

fvd_1

New member
Local time
Today, 21:37
Joined
Aug 18, 2004
Messages
7
Hi,

I have a report that i send with a e-mail (via a macro), the exported values of the report are send as a .txt-file.
Now something strange happens, between every 4 or 5 lines of text there is a blanc rule, this i want to get rit of!

So the textfile looks like:

qsdf
sdfg
dsfg

xcvb
xcvb
rty
rtye

ezrz
zerz

etc. etc.

When i send the report as a .rtf-file there are no blanc rules inbetween, so the problem lies not in the report itself i think.
But it needs to be send as a .txt file and not as a .rtf file, so if anyone knows the reason (or solution) i would be very happy!
Thanks already and kind regards,
fvd
 
You could try sending the Report source (query or Table) as a text file instead.

What do people do with this text file? does it have to be imported, or you need the layout the report provides?
 
re

Hi Ziggy,

No, i tried that, when i use a table or query as the source this does not result in a proper 'clean' textfile because there are line inbetween the rules of text, looks like this then:
---------
| zefghf |
---------
|zerzerz |
---------

So it has to go via a report...

The textfile is being use in a website to control accesscodes for registered users via a php-script, so it needs to be clean text without blanc rules.

Thanks already
 
Have you tried opening the files with notepad to see what is there? I suspect your Email may be doing the formatting for you.
What format did you export the table to a text file in?

Peter
 
Re

Hi Bat17,

Thanks for replying.
Yes, i always use notepad to open and view the textfiles.
The exported format is .txt.

I do not have the problem when i export it as a .rtf-file, then it is a clean file without empty lines etc. but unfortunately it has to be a .txt-file to use it afterwards with a PHP-script in a website.

But i found some threads about this issue on the internet and the most answers are about using a specific textheight in the report.
So i tried it and now i don't have any empty lines inbetween the text like before, only one empty line in the beginning of the textfile.
I would like te get rit of this first empty line as well, then i would have a clean and usable textfile...

Hope you can help!
Thanks,
fvd_1
 
I was meaning the format exporting directly from a query as they have always exported cleanly for me :)

Here is some code that should clean your text file up though
Code:
Sub CleanTextFile() 'remove first line from a text file
Dim strData As String, strTempName As String
Dim strDirFileName As String

strDirFileName = "c:\MyFileThatNeedsCleaning.txt" 'text file source
strTempName = "c:\MyTempTest.txt" 'temp text file

Open strDirFileName For Input As #1 'open the file for input
Open strTempName For Output As #2  'open the temp file for output
Line Input #1, strData
Do Until EOF(1)
    Line Input #1, strData
    Print #2, strData
Loop
Close #1
Close #2
Kill strDirFileName 'delete original file
Name strTempName As strDirFileName 'rename clean file
End Sub

HTH

Peter
 

Users who are viewing this thread

Back
Top Bottom