Not looping properly

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
 
M

Marshall Barton

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
 
A

APNetworking

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
 
Top