Group:  Microsoft Access » microsoft.public.access.modulescoding
Thread: RE: Case Select

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

RE: Case Select
dar 08.06.2006 12:06:01
I'm trying to learn:

I have three text boxes: a)Unit , which has 14 possible choices; b)Referral
A, Rerral B, and Referral C, which takes a number; and c)Employee, with 7
possible choices;

I thought a Case Select would work, but don't know the syntax.

End result should answer the question:
If Unit is (this), and Referral is more than 1, then Employee is (this).

I need the syntax so it looks at the Unit first, then goes to Referral A,
B,or C to determine if a number was entered, then populate the Employee text
box with appropriate Employee. It is possible for all three Referral boxes
to have a number .

I can make it work by using the If Then statement but from what I read, that
is not the best way to go. I would like to understand the Case statement
better.

Thank you in advance.

Re: Case Select
strive4peace <"strive4peace2006 at yahoo dot com"> 08.06.2006 17:28:07
Hi Dar

Select Case … Case … Case Else … End Select

The Select Case Statement executes one of several groups of
statements, depending on the value of an expression.

'~~~~~~~~~~~~~~~~~

Select Case testexpression
[Case expressionlist-n
[statements-n]] ...
[Case Else
[elsestatements]]
End Select

'~~~~~~~~~~~~~~~~~

for example:

'~~~~~~~~~~~~~~~~~

Select Case me.strControlname
Case "A"
'statements
Case "B"
'statements
Case "C", "D", "E"
'statements
Case else
'statements
End Select

'~~~~~~~~~~~~~~~~~

Select Case me.numControlname
Case Is >100
'statements
Case Is > 50
'statements
Case 20
'statements
Case 10
'statements
Case else
'statements
End Select

'~~~~~~~~~~~~~~~~~

If you send me an email and request my VBA chapters, I will
send them to you -- chapter 3 is syntax.

You can also type a keyword into the debug window (CTRL-G)
and press F1 or click on a keyword in module code and press
F1 to get help

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*

dar wrote:
[Quoted Text]
> I'm trying to learn:
>
> I have three text boxes: a)Unit , which has 14 possible choices; b)Referral
> A, Rerral B, and Referral C, which takes a number; and c)Employee, with 7
> possible choices;
>
> I thought a Case Select would work, but don't know the syntax.
>
> End result should answer the question:
> If Unit is (this), and Referral is more than 1, then Employee is (this).
>
> I need the syntax so it looks at the Unit first, then goes to Referral A,
> B,or C to determine if a number was entered, then populate the Employee text
> box with appropriate Employee. It is possible for all three Referral boxes
> to have a number .
>
> I can make it work by using the If Then statement but from what I read, that
> is not the best way to go. I would like to understand the Case statement
> better.
>
> Thank you in advance.
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net