"GMKS" <gm**@shaw.ca> wrote in
news:Z0tYb.541127$X%5.317511@pd7tw2no:
Me.Disability = "Ablebodied"
With Me
If (.Blind = True) Then
.Disability = "Disabled"
End If
If (.Deaf = True) Then
.Disability = "Disabled"
End If
If (.Deaf = True) Then
.Disability = "Disabled"
End If
If (.Paraplegic = True) Then
.Disability = "Disabled"
End If
If (.Quadriplegic = True) Then
.Disability = "Disabled"
End If
If (.Amputee = True) Then
.Disability = "Disabled"
End If
If (.Disability = True) Then
.Disability = "Disabled"
End If
If (.DevelopmentallyDelayed = True) Then
.Disability = "Disabled"
End If
If (.LearningDisabled = True) Then
.Disability = "Disabled"
End If
If (.BrainInjury = True) Then
.Disability = "Disabled"
End If
If (.SteelRod = True) Then
.Disability = "Disabled"
End If
If (.CerebralPalsy = True) Then
.Disability = "Disabled"
End If
If (.Shunt = True) Then
.Disability = "Disabled"
End If
If (.Braces = True) Then
.Disability = "Disabled"
End If
If (.SpinaBifida = True) Then
.Disability = "Disabled"
End If
End With
This can be replaced with:
With Me
!Disability = "Ablebodied"
If (!Blind) OR (!Deaf) OR (!Paraplegic) OR (!Quadriplegic) _
OR (!Amputee) OR (!Disability) OR (!DevelopmentallyDelayed) _
OR (!LearningDisabled) OR (!BrainInjury) OR (!SteelRod) _
OR (!CerebralPalsy) OR (!Shunt) OR (!Braces) OR (!SpinaBifida) _
Then !Disability = "Disabled"
End With
(I don't like the dot operator for referring to controls or fields;
others disagree)
The point here:
If you're testing Booleans and any one of them being true leads to a
particular result, you should do a Boolean operation. True Or False
is always True, so any one of the choices being True will lead to
the whole construct returning True.
Your chain of IF/THENs is way too much work, as it would repeatedly
set the Disability field for each True condition (i.e., the deaf
quadraplegic would have it set twice).
Also, there's clearly something wrong as you have .Deaf twice and
you also have .Disability itself being tested for True. I assume
both are just typos.
I'm also assuming that you're not *storing* the value, as it is
derived data, and that the Disability field is for display only. In
that case, you could have the controlsource of the Disability
textbox be (no line wrapping, of course):
=IIf((Blind) OR (Deaf) OR (Paraplegic) OR (Quadriplegic) OR
(Amputee) OR (Disability) OR (DevelopmentallyDelayed) OR
(LearningDisabled) OR (BrainInjury) OR (SteelRod) OR
(CerebralPalsy) OR (Shunt) OR (Braces) OR
(SpinaBifida)),"Disabled","AbleBodied")
You would, of course, have to resolve the circularity of having the
control called Disability refer to itself in the expression above.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc