444,124 Members | 1,746 Online
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

# Syntax problems for "IIF/Between" Statement

 P: 37 Hi Everybody, I want to be able to put a number in a txt box and if its between 5 and 9, for it to appear as a count in another txt box ie if the number inputed is 7 then 1 will appear in the second txt box, if 10 is inputed into the first txt box then 0 will appear in the second txt box. Ive tried using an IIF statement in the second txt boxes control source but Im having problems declaring the "between" part my syntax so far.... IIF([KidsAges1]Between5And9,1,0) Any help would be madly loved. Cheers Eddie Sep 1 '07 #1
4 Replies

 Expert 100+ P: 166 I want to be able to put a number in a txt box and if its between 5 and 9, for it to appear as a count in another txt box ie if the number inputed is 7 then 1 will appear in the second txt box, if 10 is inputed into the first txt box then 0 will appear in the second txt box. Ive tried using an IIF statement in the second txt boxes control source but Im having problems declaring the "between" part my syntax so far.... IIF([KidsAges1]Between5And9,1,0) Eddie, I got it to work taking a bit of a different approach. I ran something like this in the AfterExit event of txtBox1... Expand|Select|Wrap|Line Numbers If txtBox1>=5 Then    If txtBox1<= 9 Then        Me.txtBox2 = 1        Else:        Me.txtBox2 = 0    End If End If Hope that helps, Brad. Sep 1 '07 #2

 Expert 100+ P: 603 Hi Everybody, I want to be able to put a number in a txt box and if its between 5 and 9, for it to appear as a count in another txt box ie if the number inputed is 7 then 1 will appear in the second txt box, if 10 is inputed into the first txt box then 0 will appear in the second txt box. Ive tried using an IIF statement in the second txt boxes control source but Im having problems declaring the "between" part my syntax so far.... IIF([KidsAges1]Between5And9,1,0) Any help would be madly loved. Cheers Eddie how about Expand|Select|Wrap|Line Numbers IIF([KidsAges1]>=5 And [KidsAges1]<=9,1,0)   J Sep 1 '07 #3

 Expert 100+ P: 166 Even better J. That's why they pay you the BIG bucks! :) Brad. Sep 1 '07 #4

 P: 37 Thanks for your help guys, somtimes I dont see the forest for the trees.Cheers Ed Sep 3 '07 #5