from a rusty, unreliable memory, and untested:
bluecontrol.visible = ([Text8]>0) And ([Text8]<=6)
([Text8]>0) and other such logical expressions resolves to True or False.
True And True resolves to True,
True And False resolves to False
The IF ... Else statements, although more verbose, also work and are
easier
for most to read.
I think what I need to do is set the control source of the actual
square,
right? So the blue square's control source would be something like:
Iif(Text8
= 0, Visible = False, Iif(Text8 < 6, Visible = True, Iif (Text8 > 6,
Visible
= False))).
My example above (obviously) doesn't work...but is this close? What do
I
need to do to fix?
--
Thank you! - Jennifer
:
YES!!! It is a mistake - I goofed and it should all be for the Text8.
I've
changed the code but now have another snag (I seem to be full of them
today).
It seems to be coding at a higher level than I want it to. If I create
multiple records, then the change take place for the most-recently
updated
record.
What I'm showing is a figure of the right arm. Each record contains
several
Pain Index fields, representing the palm, fingers, wrist, forearm,
etc.
By
entering a number up to 6, a blue box appears over the pain area. If
greater
than 6, a black box appears (more severe pain). However, now when I
enter
an
"8" in the wrist box for record #1, all subsequent records show a
black
box
over the wrist even if they have a value of 0 or 2. I need this to be
RECORD
specific...I hope this makes sense.
---
Thank you! - Jennifer
:
Your first question was about Text8.
I see that your new question is about Text8 and Text10.
Is that a mistake?
(david)
message
David, I'm doing something wrong because no matter what number I
insert
(besides zero) only the blue box shows up - I never see the black
one.
Even
if I enter 8 or 9 - which are definitely greater than 6 - I still
don't
see
the black; just blue:
Private Sub Text8_AfterUpdate()
If Text8 = "0" Then
Me.Controls(RShoulderBlue.Name).Visible = False
Me.Controls(RShoulderBlack.Name).Visible = False
ElseIf Text10 < 6 Then
Me.Controls(RShoulderBlack.Name).Visible = False
Me.Controls(RShoulderBlue.Name).Visible = True
ElseIf Text10 > 6 Then
Me.Controls(RShoulderBlack.Name).Visible = True
Me.Controls(RShoulderBlue.Name).Visible = False
End If
End Sub
--
Thank you! - Jennifer
:
if text8 = 0 then
elseif text8 < 6 then
else
endif
(david)
in
message
I have a text box that the users enter a number between 1 and
10.
If
the
enter a number between 1 and 5, I want a blue box to appear;
if
between
6
and 10, I want a black box to appear. I've been able to code
it
partially
but
don't know how to make the range included (if between 6 and 10
then),
etc.
What I have so far is listed below - thank you!!!
Private Sub Text8_AfterUpdate()
If Text8 = "0" Then
Me.Controls(Yellow.Name).Visible = False
Me.Controls(Blue.Name).Visible = False
Else
Me.Controls(Yellow.Name).Visible = True
Me.Controls(Blue.Name).Visible = False
ELSe
Me.Controls(Yellow.Name).Visible = False
Me.Controls(Blue.Name).Visible = True
End If
End Sub