Solved

Using Case Logic

Posted on 2006-10-22
4
270 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:pinkstonm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 125 total points
ID: 17783951
since you are trying to do a OR on 2 variables, you need If-Else If.


If Grade  7 And Sex = "Girl" Then
    '
ElseIf Grade  8 And Sex = "Body" Then
    '
End If
0
 
LVL 9

Expert Comment

by:Hypnochu
ID: 17784065
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
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17784445
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!
0
 
LVL 9

Expert Comment

by:Hypnochu
ID: 17784525
>> 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
   
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question