I have a For Next construct. I sometimes have a condition where I need to skip to the next iteration. How do you do it in Access VBA, that is do a Next.
There are numerous approaches. The best one depends on what you're dealing with. For example:
Code:
Sub Demo()
Dim i As Integer
For i = 1 To 10
If i = 3 Then
i = 4
Else
'Do something else
End If
MsgBox i
Next i
For i = 1 To 10
'Some test here, eg:
If MsgBox("Skip the next item?", vbYesNo) = vbYes Then i = i + 1
MsgBox i
Next i
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.