By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
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
Share this Question
Share on Google+
4 Replies


BradHodge
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
  1. If txtBox1>=5 Then
  2.    If txtBox1<= 9 Then
  3.        Me.txtBox2 = 1
  4.        Else:
  5.        Me.txtBox2 = 0
  6.    End If
  7. End If
Hope that helps,
Brad.
Sep 1 '07 #2

JConsulting
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
  1. IIF([KidsAges1]>=5 And [KidsAges1]<=9,1,0)
  2.  
J
Sep 1 '07 #3

BradHodge
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

Post your reply

Sign in to post your reply or Sign up for a free account.