IF..THEN

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the correct way to combine two tests in a vb if..then block
ie if x>10 AND x<25

I think I have a bug outwith the if..then and need to test, but I am unable
to access help files at the mo.

cheers,
Kenny
 
That's correct. Just missing the "Then".
If the expressions are actually more complex, brackets might help.
Try:
If (x > 10) AND (x < 25) Then

If either of the values could be Null (e.g. if you are reading values from
text boxes instead of the literal values 10 and 25), the expression will
never be True. See:
Common errors with Null
at:
http://allenbrowne.com/casu-12.html
 
what I wrote was just an example with the word 'AND' used to
communicate my meaning, I didnt actually try the word 'and' in the code
(I was trying '&' '&&' etc)!

Thank you!
 
I C that you've been drinking JAVA again. Access doesn't recognize &&
as the equivalent of the word AND
 
Back
Top