Solved

Using Case Logic

Posted on 2006-10-22
4
263 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now