If...Then are always Boolean.
PHV, you are correct.
"An Or operation performs a logic operation on expressions, not values." is not quite accurate.
However, I will have to disagree with: "should be read "full expressions evaluating to a boolean value"
ComboBox10.Text = "120FBK" Or ComboBox10.Text = "125L"
Both sides of the Or are expressions. They themselves do not evaluate to a boolean value. The Or operator itself does that, which is why it requires expressions. Expressions can be compared
to each other using Boolean logic.. which is exactly what Or does.
That being said, you are of course still correct. An Or statement can indeed be valid using just values. But those values must
already be Boolean.
Code:
Dim Bool_A As Boolean
Dim Bool_B As Boolean
Bool_A = False
Bool_B = True
If [b]Bool_A[/b] Or [/b]Bool_B[/b] Then
is a valid Or operation.
Code:
Dim strOne As String
Dim strTwo As String
strOne = "Yadda"
strTwo = "BlahBlah"
If strOne Or strTwo Then
is NOT. The variables are values, but...it returns a mis-match error as...the values themselves are neither Boolean, nor resolvable as Boolean by the Or operation. Type mis-match.
Code:
Dim strOne As String
Dim strTwo As String
strOne = "Yadda"
strTwo = "BlahBlah"
If strOne = "Mexico" Or strTwo = "BlahBlah" Then
will work as the expressions themselves can be compared
by the Or operation using Boolean logic.
So unless the values used by Or are already Boolean, you MUST use expressions that can be compared by Boolean logic.
If ComboBox10.Text = "120FBK" Or "125L" can NOT be compared by Boolean logic, because "125L" is not a value OF something. It is not an expression OF something.
Further,
Code:
Dim strOne As String
Dim Bool_A As Boolean
Bool_A = False
strOne = "Yadda"
If strOne Or Bool_A Then[/code[ will also fail the Or, type mis-match. Even though both sides of the Or ARE values. StrOne can not be resolved using Boolean logic. It is the Or operation itself that performs the boolean logic. The expression themselves do not need to resolve to boolean, it is the [b]comparison[/b] - as performed by Or - that must be resolvable to boolean.
faq219-2884
Gerry
[url=http://www3.telus.net/public/fumei/]My paintings and sculpture[/url]