Solved

# Using Case Logic

Posted on 2006-10-22
269 Views
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

This is for a youth non-profit bball league

Thanks
0
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
• 2

LVL 33

Accepted Solution

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

ID: 17784065
I would go for something like

Select Case Sex
Case "Boy"
Case 1
'do whatever for Boy grade 1
Case 2
'do whatever for Boy grade 2

'...etc

End Select
Case "Girl"
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

ID: 17784445
Hi pinkstonm,

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

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

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"
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

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

Question has a verified solution.

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

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…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
###### Suggested Courses
Course of the Month8 days, 18 hours left to enroll