Really lost, need some input or an example.

J

Jeff Uchtman

I am having trouble grasping this due to brain block or just lack of brain..
I and doing a CBool on 3 true or false. I need all 3 to answer true to
display. If one or more are false it equals false. I tried this but after
looking at it and reading some comment I agree its a statement not a
function:

<%
Dim A, B, C 'As Integer
Dim Check 'As Boolean
A = rs("PetA")
B = rs("PetB")
C = rs("PetC")
Check = CBool(A = B = C) ' Check is set to True.
%>

PetA, PetB, and PetC are my true and false triggered by a check box. Ray
made a great point in an earlier question stating the function needs to
follow:
True + True + True = True
True + True + False = False
True + False + False = False
False + False + False = False
I have found examples of CBool by 2 items and it makes sense, the third item
is driving me crazy. Any help or pointing to some example text would be
much appreciated.

Jeff
 
R

Ray at

If A, B, and C are integers and you want to treat them as booleans, can I
assume that any non-zero integer is true and 0 is false? (That would be the
norm.) Assuming that, if you need all A, B, and C to be true in order for
Check to be true, you can do:


A = CBool(rs.Fields.Item("PetA").Value)
B = CBool(rs.Fields.Item("PetB").Value)
C = CBool(rs.Fields.Item("PetC").Value)

Check = A And B And C

If A, B, OR C is false, Check will be false. If all three A, B, and C are
true, then only then will C be true.
 
J

Jeff Uchtman

Ray you are the man. The light blub is on and it makes sense. Thanks!

Still learning
Jeff
 
R

Ray at

Cool! :]

--

Ray at home
Microsoft ASP MVP


Jeff Uchtman said:
Ray you are the man. The light blub is on and it makes sense. Thanks!

Still learning
Jeff


"Ray at <%=sLocation%> [MVP]" <myFirstNameATlane34dotKOMM> wrote in message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top