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