angela022687
New Member
- Joined
- Aug 1, 2014
- Messages
- 6
Hi,
I have 30 different cases working well in one module so far. Now I need to add some more cases, but the system doesn’t allow me to start defining any new cases under Select – Case, it shows: compile error: procedure too large.
I’m thinking maybe there’s a way to combine multiple cases like Case 30, 31, 32 in one statement, and use if, else to define each one?? So the coding won’t return the “Procedure Too Large” error? see my original coding as below:
counter = 0
colkey = 0
For Each cont In PriceForm.HaveFrame.Controls
If TypeName(cont) = "CheckBox" Then
counter = counter + 1
check = cont.Value
If check = True Then
colkey = colkey + 1
Select Case counter
Case 1
have.Add Item:="Product 1", Key:=CStr(colkey)
Case 2
have.Add Item:=" Product 1", Key:=CStr(colkey)
……………
Case 31
have.Add Item:=" Product 31", Key:=CStr(colkey) '''After I added this case, it returned” Procedure Too Large” error
End Select
End If
End If
Next cont
Does anyone know what’s the problem here?
Thanks in advance!
I have 30 different cases working well in one module so far. Now I need to add some more cases, but the system doesn’t allow me to start defining any new cases under Select – Case, it shows: compile error: procedure too large.
I’m thinking maybe there’s a way to combine multiple cases like Case 30, 31, 32 in one statement, and use if, else to define each one?? So the coding won’t return the “Procedure Too Large” error? see my original coding as below:
counter = 0
colkey = 0
For Each cont In PriceForm.HaveFrame.Controls
If TypeName(cont) = "CheckBox" Then
counter = counter + 1
check = cont.Value
If check = True Then
colkey = colkey + 1
Select Case counter
Case 1
have.Add Item:="Product 1", Key:=CStr(colkey)
Case 2
have.Add Item:=" Product 1", Key:=CStr(colkey)
……………
Case 31
have.Add Item:=" Product 31", Key:=CStr(colkey) '''After I added this case, it returned” Procedure Too Large” error
End Select
End If
End If
Next cont
Does anyone know what’s the problem here?
Thanks in advance!