473,424 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 software developers and data experts.

Syntax problems for "IIF/Between" Statement

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 5371
BradHodge
166 Expert 100+
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
603 Expert 512MB
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
166 Expert 100+
Even better J. That's why they pay you the BIG bucks! :)

Brad.
Sep 1 '07 #4
Thanks for your help guys, somtimes I dont see the forest for the trees.Cheers Ed
Sep 3 '07 #5

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

Similar topics

3
by: Susie Swint | last post by:
I have the following IIf statement which worked in Access 95 but will not work in Access 2002. The error message I get is that the expression is typed incorrectly, or is too complex to be...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
4
by: Jim Florence | last post by:
Hello, I've just started in ASP and I'm having a few teething problems. Initially I tried to write out dates from the database using <asp:Label runat="server" ID="Label6" Text='<%#...
6
by: Chris Waller | last post by:
Dear All, I am experiencing a problem with an IIF statement in Access. As I have never created one of these before I am having real problems getting my head around them. What I am trying to do is...
3
newnewbie
by: newnewbie | last post by:
Have a nested IIF statement that works but returns wrong values....Here's the syntax: Expr3: IIf(=2 Or 3,'valid',IIf(=4,'invalid','unknown')) Needed: if validity is 2 or 3 = Valid, if...
5
towsie
by: towsie | last post by:
Hi, I am trying to add the following IIf statement to a query, IIf(.=50,("-" & .),.) The statement is supposed to make any value that has a posting key of...
1
by: Darknight850 | last post by:
Hello Every One, I am having a problem with an IIF statement in a query I have going. Before I start I would like to say I have had some problems in the past with supplying enough information, if...
1
by: ebasshead | last post by:
Hi everybody, On my form, I have a time field where the user enters a time, if the user enters a time between 4am and 12pm, I would like my "early checkin" check box to check itself. I thought the...
2
by: buddyr | last post by:
example: field1 bblandscape, wallmart, kmart field2 4,6,9 field3 5,7,6 field4 12,0,5 field5 if field2 > field3 then field5 = "Yes" if field4 = 0 then field5 = "Yes"
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.