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!

Code Problem!!!

Status
Not open for further replies.

Gti

Programmer
Jul 23, 2001
99
PT
I have this code...

N_Registos = 5

Set rs = CurrentDb.OpenRecordset("PreSeleccao")


For apontador = 1 To N_Registos

Print #1, Corpo

rs.MoveNext

Next apontador

What i need is print many registers i have i my table, but the MoveNext don't pass to other register. What's the problem?

Any Help

Tkx ;-)
 
mm bit hard to guess without knowing what your fields are but how about changing it to a do loop


N_Registos = 5

Set rs = CurrentDb.OpenRecordset("PreSeleccao")

rs.movefirt
Do until N_Registos = 5

Print #1, Corpo

rs.MoveNext

N_Registos = N_Registos + 1

Next



 
How about this variation - If you want to print from every record in the table:

Set rs = CurrentDb.OpenRecordset("PreSeleccao")

rs.movefirst

do until rs.eof
Print #1, Corpo
rs.MoveNext
loop

I hope this was helpful.
 
But in all of the responses, "Corpo" is NOT changed. It is NOT part of rs, so the movenext doesn't affect it. It is NOT set in the loop to a VALUE, so whatever it is on the entrance to the stays that SAME whatever.

just a SWAG:

Code:
     N_Registos = 5

     Set rs = CurrentDb.OpenRecordset("PreSeleccao")             


     Do While Not rs.EOF
          Print #1, !Corpo     'ASSUMES Corpo is a field in "rs"
   
          rs.MoveNext
  
     Loop
MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top