Monday, September 17, 2012 7:00 PM
Is there a maximum number of cases nested in a select case ?
Monday, September 17, 2012 8:00 PM
Wednesday, September 19, 2012 5:57 PM
well as was using about 160 case just by repeating two conditions interpreted as not working ...
Already corrected. Up to 160 can guarantee that it works. ;)
Friday, September 21, 2012 11:14 AM
If 160+ cases are needed, I suspect that these values for the cases should be handled as Field values in Table(s) and not in code.
VBA code / Select Case ... statement cannot replace data stored in Table(s). Besides with 160 cases, it is certainly more efficient for the ACE/JET database engine to handle and not VBA processing.
- Marked As Answer by João Simplicio Rodrigues Friday, September 21, 2012 10:06 PM
Friday, September 21, 2012 11:24 AM
Ah, I thought you were "nesting". But it seems like you just have multiple included Case statements.
I don't know of any limit as to how many Case statements can be included in a Select Case ... construct. I suspect it has more to do with limits on VBA project size.
However, as Van Dinh has pointed out, it might be more efficient to construct some kind of lookup table, or array, to access these alternatives.