Solved

Using Case Logic

Posted on 2006-10-22
4
267 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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
key press alert 2 42
Date on a table 16 35
Replace value 2 34
JQuery on multiple lines 3 16
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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