- Local time
- Today, 17:55
- Joined
- Sep 12, 2006
- Messages
- 16,026
Dave,
this is interesting as general information, but can it also help with data validation?
Henry
no. just highlighting potential uses for Boolean "arithmetic".
the underlying problem is that vba syntax is quite restrictive in some ways.
so you can't say
dim a,b,c as integer
(well you can, but what it ACTUALLY does is declares a and b as VARIANTS, and c as an integer, which fact can again introduce unwanted side effects into your app.)
you have to say
dim a as integer
dim b as integer
dim c as integer
you can't say this to initialise a variable. no tricks on this one - you can't do it.
dim a as integer =123
and you can't say
if a = 1 or 2 or 3
(well you can, but as you realised it doesn't mean
if a=1 or if a =2 or if a =3)
if means
if a = (1 or 2 or 3), and (1 or 2 or 3) is actually a fairly obscure Boolean expression, as already explained.