On debug I am receiving the error named in the title of this post. I cannot see why. When I look back at the code it sends me to this function.
Private Function LightChange(Number)
'/===============================================================
'/ This function determines which lights to turn on or off
'/===============================================================
'/ This function
'/ - Determines how many lights to turn on or off
'/===============================================================
'/===============================================================
'/ Variable Declarations
Dim LNum As Integer
Dim LControl As Integer
'/===============================================================
'/ Variable Value Assignments
Let LNum = Number
Let LControl = 1
'/===============================================================
'/ Light switch decision loop
'/ Loop Control Variable: LControl is the LCV
'/ Loop Initialization: At initializaiton LControl is 1
'/ Loop Update: At each iteration of the loop LControl is incremented
'/ by 1.
'/ Loop Termination: At initialization LControl is 1 and is incremented
'/ by 1 at each iteration of the loop. Eventually LControl will be
'/ greater than 5 terminating the loop.
Do While LControl <= 5
Select Case LControl
Case 1
Switcher LNum
Case 2
If LNum > 20 Then
Switcher (LNum - 10)
End If
Case 3
If LNum - 1 Mod 10 <> 0 Then
Switcher (LNum - 1)
End If
Case 4
If LNum Mod 5 <> 0 Then
Switcher (LNum + 1)
End If
Case 5
If LNum < 50 Then
Switcher (LNum + 10)
End Select
Loop
End Function
And just for completions sake (and because the previous code references it):
Private Function Switcher(Number)
'/===============================================================
'/ This function changes the state of the light indicated by Number
'/===============================================================
'/ This function
'/ - Determines the state of the light
'/ - Changes the state of the light
'/===============================================================
'/===============================================================
'/ Variable Declarations
Dim LNum As Integer
Dim State As Boolean
'/===============================================================
'/ Variable Value Assignment
Let LNum = Number
'/===============================================================
'/ State Determination
If Me.Controls("Light" & LNum).BackColor = RGB(0, 0, 0) Then
Let State = False
Else
Let State = True
End If
'/===============================================================
'/ State Change
If State = True Then
Me.Controls("Light" & LNum).BackColor = RGB(0, 0, 0)
Else
Me.Controls("Light" & LNum).BackColor = RGB(255, 255, 0)
End If
End Function
Bookmarks