473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Skip to Next (in a for each next loop) if condition is met

Hi, I cannot find the right way to write this code. I keep getting the
error : Next without For

Here's my code.

For Each Choix In RapInd_Code.ItemsSelected
S6 = LBo_RapInd_Code.ItemData(Choix)
S7 = DLookup...
S8 = DLookup...

If (S7 < 8) Or (S8 < 0.5) Then
---MY PROBLEM IS HERE---
Next Choix (HERE I WANT IT TO directly go to the next step)
Else
For i = 1 To S6
...call a procedure in SQL
Next i
End If
Next Choix
Thank you all

Nov 13 '05 #1
2 4109
Patrik wrote:
Hi, I cannot find the right way to write this code. I keep getting the
error : Next without For

Here's my code.

For Each Choix In RapInd_Code.ItemsSelected
S6 = LBo_RapInd_Code.ItemData(Choix)
S7 = DLookup...
S8 = DLookup...

If (S7 < 8) Or (S8 < 0.5) Then
---MY PROBLEM IS HERE---
Next Choix (HERE I WANT IT TO directly go to the next step)
Else
For i = 1 To S6
...call a procedure in SQL
Next i
End If
Next Choix
Thank you all


Just take out the middle "next", since the rest of the loop is in the
"else" condition the code will skip it down to the proper "next"

--
[OO=00=OO]
Nov 13 '05 #2
On 13 Jul 2005 13:19:48 -0700, Patrik wrote:
Hi, I cannot find the right way to write this code. I keep getting the
error : Next without For

Here's my code.

For Each Choix In RapInd_Code.ItemsSelected
S6 = LBo_RapInd_Code.ItemData(Choix)
S7 = DLookup...
S8 = DLookup...

If (S7 < 8) Or (S8 < 0.5) Then
---MY PROBLEM IS HERE---
Next Choix (HERE I WANT IT TO directly go to the next step)
Else
For i = 1 To S6
...call a procedure in SQL
Next i
End If
Next Choix

Thank you all


For Each Choix In RapInd_Code.ItemsSelected
S6 = LBo_RapInd_Code.ItemData(Choix)
S7 = DLookup...
S8 = DLookup...

If (S7 < 8) Or (S8 < 0.5) Then

' *** Nothing is needed here
Else
For i = 1 To S6
...call a procedure in SQL
Next i
End If
Next Choix
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shill | last post by:
I have several questions. In C, AFAIU, a for loop is just syntactic sugar for a while loop. for (i1; i2; i3) i4; is equivalent to i1 while (i2) {
3
by: eBob.com | last post by:
I have the following loop in my simple program ... Do line = sr.ReadLine() If Not line Is Nothing Then linecount = linecount + 1 If line.Length > 0 Then If line.Chars(0) = "*"c Then...
3
by: new q. | last post by:
I've tried testing this to see if there is any difference but couldn't find any... is there any difference in doing a For - Next loop with/without a value after the 'Next' at the end? e.g....
2
by: LostDeveloper via AccessMonster.com | last post by:
Relationship goes Certification can have multiple variations (any single variation satifies the certification), which require multiple course groups which require any one of the products assigned...
6
by: jimhakans | last post by:
hi, Actually i have seen this program in my book and cant get one thing, the while loop, Why we have used condition not equal to carriage return. One more thing this program is not incrementing the...
32
by: ndedhia1 | last post by:
Right now, I am using this line of code to get rid of data in a file called alarmNotification that I do not want: egrep "low debug.*\".*\"" $dbDir/alarmNotification.log but I am having some...
1
by: baris22 | last post by:
hello, this is my code. output of this code is like this: item amount item name 1 jacket 3 top 3 top 3 top
1
by: JEFFREY MUSGRAY | last post by:
I am reading the text file and it works fine, until a start of string is not present. In that case it begins at start of text file and inserts all data to end point. For example: ! =...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.