Not looping properly

  • Thread starter Thread starter Alain
  • Start date Start date
A

Alain

Hi, can anyone tell me why my loop is not moving to the next recordset
properly, I am always stuck to the same record
It is a very simple Do loop but seems I cannot make it work
Thanks

Set bds = CurrentDb
Set grs = bds.OpenRecordset("GrossMois")

With grs
Do Until grs.EOF
vendor = ![VendorNumber]
split = Nz(![SplitVc], 0)
Debug.Print vendor
Debug.Print split
Loop
End With

rst.Close
grs.Close
Set bds = Nothing
 
Alain said:
Hi, can anyone tell me why my loop is not moving to the next recordset
properly, I am always stuck to the same record
It is a very simple Do loop but seems I cannot make it work
Thanks

Set bds = CurrentDb
Set grs = bds.OpenRecordset("GrossMois")

With grs
Do Until grs.EOF
vendor = ![VendorNumber]
split = Nz(![SplitVc], 0)
Debug.Print vendor
Debug.Print split
Loop
End With

rst.Close
grs.Close
Set bds = Nothing


The last line in the loop needs to be .MoveNext
 
Hi Alain,
It looks to me like you are missing the command telling it to move to the
next record each time it goes through the loop.
Right before line that says Loop, try adding this line:

grs.MoveNext

Andy
 

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

Back
Top