1. ## Triple State Boolean

I know it defies the definition of boolean, but is there such thing as a triple state boolean variable? There is a triple state check box, you know. And check boxes were once only boolean in nature.

I want to test for the existence of a document variable in a function defined as boolean and return either 1) a value indicating the doc var does not exist, 2) that it exists and has a certain value or 3) it exists and does not have a certain value.

Should I instead define the function as string and return "NO", "TRUE" or "FALSE"?

2. ## Re: Triple State Boolean

You can define the function as Boolean and return +1, 0, and -1. However, you can't use "True" as a test for its state since any value other than 0 is considered true. You could also define it as Integer and return the same things.

3. ## Re: Triple State Boolean

Legare,

Thanks for the insight. I'll code up the thing and see if I can make it work.

4. ## Re: Triple State Boolean

You could try someting like <pre>Function TriState() AS Variant
Select Case Tri
Case Is = 1
TriState = CBool(False)
Case Is = 2
TriState = CBool(True)
Case Is = 3
TriState = "No"
End Select
End Function</pre>

An Logic test on the result of the above returns either True, False or an Error, so if you test for an error, and if not found then test for True or False. It's a bit convoluted but it will either work, or wont work or maybe it will.

Andrew C

5. ## Re: Triple State Boolean

Tri-state is usually represented in one of the following ways:

1. negative, zero, positive
2. No, Maybe, Yes
3. Connecticut, New Jersey, New York

6. ## Re: Triple State Boolean

That's the Howard we all know and love...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•