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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newline doesn't work!!! 2

Status
Not open for further replies.

qajussi

Programmer
Mar 22, 2004
236
US
Hi!

I am looping through Access database table and printing them out but it won't print on the newline.

What is up with this WriteLine??

demofile.WriteLine(rsRefNum("ForumID"))

This prints out like this:
3 4 5 6 7

WriteLine should print them out like this:
3
4
5
6
7


How do I print it on the newline??

Here is part of my code:
Set demofile = fso.CreateTextFile("C:\Q\vbs\" & filename & ".xml")
demofile.WriteLine("<?xml version='1.0' encoding='ISO-8859-1'?>")
demofile.WriteLine("<agent>")
demofile.WriteLine("YOUR FILE IS IN :")
'Read from Access DB
Do Until rsRefNum.EOF
demofile.WriteLine(rsRefNum("ForumID"))
demofile.WriteLine(rsRefNum("ForumName"))
'demofile.WriteLine(rsRefNum("ForumDescription"))
demofile.WriteLine(rsRefNum("ForumOwner"))
rsRefNum.MoveNext
Loop
'End of Access DB
demofile.WriteLine("</agent>")
demofile.Close
Conn.Close
 
This prints out like this:
3 4 5 6 7

How are you looking in this .xml file ?
Try with notepad to be sure you really have a new line issue.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thank you for your help.

This is what it looks like:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<agent>YOUR FILE IS IN : 3 Announcements robclark 4 Test robclark 5 Feedback robclark 6 Product B robclark 7 Product Ideas robclark</agent>

It doesn't print out on the newline..

Do you think it is doing that because of xml ??

Is there another way to insert a newline??

Thanks again.
 
AFAIK notepad don't have special meaning about xml files.
Have you tried to concatenate a vbCrLf at the end of each line you write, like this ?
demofile.WriteLine rsRefNum("ForumID") & vbCrLf

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hm..
I tried & vbCrLf..
No affect...

Don't know why???

THanks again..
 
Hello qajussi,

It is to re-register vbscript.dll.
Code:
    regsvr32 vbscript.dll
regards - tsuji
 
Hi tsuji!

can you explain more why I need to re-register it again??
the vbscript runs fine...
Just that the newline is not working correctly...
I think this has to do with XML file...

Thanks.
 
qajussi,

I do not have a clue. But, I guess xml/dbase has nothing to do here. The reason is that your output line "YOUR FILE IS IN:" is not well-behaved already. Furthermore, there do exist reported abberrations of an incomprehensible type which is made right by re-register the script engine. Beside, registering it again will do absolutely no harm to your system. Whether it will do any good, I cannot say for sure.

Before doing any thing, try take away the () when you write line, see how it takes?

regards - tsuji
 
can't you just do this?

demofile.WriteLine("YOUR FILE IS IN :<br>")

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Thanks guys.

The <br> doesn't work.

I think this is due to XML file.

I just created a XML tag and wrap the record with it and it seems to work.

the result looks like this:

3
news
john

4
email
mike

5
news
phil

....etc..

Thanks again guys for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top