Loop problem

  • Thread starter Thread starter quixote
  • Start date Start date
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
 
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
 
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
 
Back
Top