noob with loops

penfold1992

Registered User.
Local time
Today, 16:29
Joined
Nov 22, 2012
Messages
169
I am trying to create a sort of "Batch record creator"
the code works for an individual value but when I try to loop it, it fails...
the code is long and I dont want to post all of it but the "looping" part is this...

Code:
For i = 1 To BatchNo.Value
(a chunk of code)
Next i
The problem I occur is:
"Next without For"
but the Next i is definatly there... and the For is also there...

anyone know what the reason is for this to fail?
 
penfold1992, i think the culprit is (a chunk of code) inside that chunk there lies a line or a statement that will make the Next unreachable.. So unless you want to show the entire code in between the construct, it might be quiet infeasible to identify the problem.. Also use just Me.BatchNo no need of the last .Value, by default it is included..
 
I agree with Paul. If you want help/advice/assistance/suggestions, you are going to have to show us something. We only know what you tell us about your application/database/business/issue. So if you choose to tell nothing or bare minimum, we are not likely to try to guess what you need.

Suggest you tell us what you are trying to do in plain English, and what you would like from us.
 
I was assuming the "loop" part was set up wrongly but with no feedback on the actual looping part I went back and had a look at the code. (assuming the loop was right)
It is infact correct and the problem was the placement of the loop... It was inside a "If" statement which was causing it to have that error.

apologies for making myself unclear, I just assumed my loop part was wrong (missing syntax or something)
 

Users who are viewing this thread

Back
Top Bottom