T
thusnani
Im trying to put if loops in one for loop and im getting this error:
"Complie Error: Next without for"
Here is my code. What am i forgetting
Dim i As Integer
i = 1
For Each varItem In Me!ProjectList.ItemsSelected
project = Me!ProjectList.ItemData(varItem)
If i = 1 Then
Label1.Visible = True
Label1.Caption = project
Else
If i = 2 Then
Label2.Visible = True
Label2.Caption = project
Else
If i = 3 Then
Label3.Visible = True
Label3.Caption = project
Else
If i = 4 Then
Label4.Visible = True
Label4.Caption = project
Else
If i = 5 Then
Label5.Visible = True
Label5.Caption = project
Else
If i = 6 Then
Label6.Visible = True
Label6.Caption = project
Else
If i = 7 Then
Label7.Visible = True
Label7.Caption = project
Else
If i = 8 Then
Label8.Visible = True
Label8.Caption = project
Else
If i = 9 Then
Label9.Visible = True
Label9.Caption = project
Else
If i = 10 Then
Label10.Visible = True
Label10.Caption = project
End If
i = i + 1
Next varItem
"Complie Error: Next without for"
Here is my code. What am i forgetting
Dim i As Integer
i = 1
For Each varItem In Me!ProjectList.ItemsSelected
project = Me!ProjectList.ItemData(varItem)
If i = 1 Then
Label1.Visible = True
Label1.Caption = project
Else
If i = 2 Then
Label2.Visible = True
Label2.Caption = project
Else
If i = 3 Then
Label3.Visible = True
Label3.Caption = project
Else
If i = 4 Then
Label4.Visible = True
Label4.Caption = project
Else
If i = 5 Then
Label5.Visible = True
Label5.Caption = project
Else
If i = 6 Then
Label6.Visible = True
Label6.Caption = project
Else
If i = 7 Then
Label7.Visible = True
Label7.Caption = project
Else
If i = 8 Then
Label8.Visible = True
Label8.Caption = project
Else
If i = 9 Then
Label9.Visible = True
Label9.Caption = project
Else
If i = 10 Then
Label10.Visible = True
Label10.Caption = project
End If
i = i + 1
Next varItem