Can i simplify my Select Case
My question is can i simplify my code since it seems too lengthy to me.
I have two option group controls, the first is called months and
consist of the 12 options( the months). The second option group is
called office and consist of 10 offices.My code allows either to open a
report without choosing the second option group, or chosing a month and
the office.It is fine, however it is too lengthry, i have to write the
12 select cases of the months, and then i must insert the ten
possibilties of the offices.Is there a way to make my code more
compact?
i will quote only the select cases for the first two months:
Select Case month
Case 1
If office = “” Then
strCriteria = jan
ElseIf office = 1 Then
strCriteria = jan & strLondon
ElseIf office = 2 Then
strCriteria = jan & strLiverpool
ElseIf office = 3 Then
strCriteria = jan & strManchester
ElseIf office = 4 Then
strCriteria = jan & strBerlin
ElseIf office = 5 Then
strCriteria = jan & strRome
ElseIf office = 6 Then
strCriteria = jan & strWien
Case 2
If ofice = “” Then
strCriteria = feb
ElseIf office = 1 Then
strCriteria = feb & strLondon
ElseIf office = 2 Then
strCriteria = feb & strLiverpoll
ElseIf office = 3 Then
strCriteria = feb & strManshester
ElseIf office = 4 Then
strCriteria = feb & strBerlin
ElseIf office = 5 Then
strCriteria = feb & strRome
ElseIf office = 6 Then
strCriteria = feb & strWien