Loop problem

Q

quixote

I am having problems with the following loop. For some
reason after I go to a record the VbNewLine doesn't work(I
also tried VbCrLf). Also when I try to loop to the next
record i was still equal to fields.count-1, that is why I
have i=0 before I loop again. Every loop just seems to
concatenate the first record over and over.

Do While Not rs.EOF()
'create the tilde delimited line


For i = 0 To rs.Fields.Count - 1
textline = textline & rs.Fields(i) & "~"
Next
'get rid of last tilde
textline = Left(textline, Len(textline) - 1)
'print the line and move down to next line
Print #1, textline; vbNewLine

i = 0

Loop

Close #1



.....thanks
 
T

Ted

I think you need to replace the i=0 statement with
rs.movenext to move to the next record prior to looping
and checking to see if you are at rs.EOF
 
M

Mark A. Sam

WIthout looking at any more code, adjust this line,

Do While Not rs.EOF()
to this

Do While Not rs.EOF

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top