Link to home
Start Free TrialLog in
Avatar of pinkstonm
pinkstonm

asked on

Using Case Logic

I have an ASP app that uses a access DB and I would like to use case logic to control what is displayed in a drop down.

in my record the players Grade and Sex are known in those names and those two should control the Team field.

For example if Grade = 7 or 8 and Sex = Girl then Teams drop down should have the following
      (wildcats, shock, fever, mystics)

If grade = 8 and Sex = Boy then teams = another set of teams

I would have about 10 combinations of Grade and Sex.

This is for a youth non-profit bball league

Thanks
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hypnochu
Hypnochu

I would go for something like

Select Case Sex
      Case "Boy"
            Select Case Grade
                  Case 1
                        'do whatever for Boy grade 1
                  Case 2
                        'do whatever for Boy grade 2
                  
                  '...etc
                  
            End Select
      Case "Girl"
            Select Case Grade
                  Case 1
                        'do whatever for Girl grade 1
                  Case 2
                        'do whatever for Girl grade 2
                  
                  '...etc
                  
            End Select      
End Select
Avatar of David Lee
Hi pinkstonm,

I'd go with a modified version of Hypnochu's suggestion.  Something like this

    Select Case Sex & Grade
        Case "Boy7"
            'Do whatever for boy's in 7th grade
        Case "Boy8"
            'Do whatever for boy's in 8th grade
        Case "Girl7"
            'Do whatever for girl's in 7th grade
        Case "Girl8"
            'Do whatever for girl's in 8th grade
    End Select

Cheers!
>> For example if Grade = 7 or 8 and Sex = Girl then

Don't forget you can have more than one condition in each case, so:

       Case "Girl"
                        Select Case Grade
                                     Case 1
                                                      'do whatever for Girl grade 1
                                     Case 2
                                                      'do whatever for Girl grade 2
                                     Case 7,8
                                          'fill list with wildcats, shock, fever, mystics
                                     '...etc

                        End Select    
End Select

or using BlueDevilFan's suggestion

  Select Case Sex & Grade
        Case "Boy7"
            'Do whatever for boy's in 7th grade
        Case "Boy8"
            'Do whatever for boy's in 8th grade
        Case "Girl7", "Girl8"
            'fill list with wildcats, shock, fever, mystics
        ' ... etc
    End Select