473,405 Members | 2,354 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,405 software developers and data experts.

trouble with the IIF

I'm trying to use IIF and having hasseles.

The statement below is a generic example of what I am trying to achieve
but of course it will not work!

IIf([CountofSurname]>=13,"1") Or IIf([CountofSurname] Between 1 And
18,"1" and "2" ) Or IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3") Or IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4")

In other words if the count is between 1 and 18 then return all the
ones and the twos.

Any help would be appreciate. TIA - R

Nov 13 '05 #1
3 4480
On 6 Nov 2005 00:52:53 -0800, "Chesne" <as******@paradise.net.nz> wrote:
I'm trying to use IIF and having hasseles.

The statement below is a generic example of what I am trying to achieve
but of course it will not work!

IIf([CountofSurname]>=13,"1") Or IIf([CountofSurname] Between 1 And
18,"1" and "2" ) Or IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3") Or IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4")

In other words if the count is between 1 and 18 then return all the
ones and the twos.

Any help would be appreciate. TIA - R


Remove the "Or"s and nest the IIF statements. Each IIF statement becomes the second argument of the previous statement.
Something like - (air code)

IIf([CountofSurname]>=13,"1",IIf([CountofSurname] Between 1 And
18,"1" and "2",IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3",IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4"))))
Nov 13 '05 #2
Wayne Gillespie wrote:
On 6 Nov 2005 00:52:53 -0800, "Chesne" <as******@paradise.net.nz> wrote:

I'm trying to use IIF and having hasseles.

The statement below is a generic example of what I am trying to achieve
but of course it will not work!

IIf([CountofSurname]>=13,"1") Or IIf([CountofSurname] Between 1 And
18,"1" and "2" ) Or IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3") Or IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4")

In other words if the count is between 1 and 18 then return all the
ones and the twos.

Any help would be appreciate. TIA - R

Remove the "Or"s and nest the IIF statements. Each IIF statement becomes the second argument of the previous statement.
Something like - (air code)

IIf([CountofSurname]>=13,"1",IIf([CountofSurname] Between 1 And
18,"1" and "2",IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3",IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4"))))

It appears the op wants a message like "1 and 2" or "1 and 2 and 3 and
4". I'm not sure if
"1" and "2"
will work. It might be better with
"1 and 2"

The original statement was so flawed I wouldn't have wanted to tackle
it. Kudus for making sense out of it.
Nov 13 '05 #3
On Sun, 06 Nov 2005 19:09:50 GMT, Salad <oi*@vinegar.com> wrote:
Wayne Gillespie wrote:
On 6 Nov 2005 00:52:53 -0800, "Chesne" <as******@paradise.net.nz> wrote:

I'm trying to use IIF and having hasseles.

The statement below is a generic example of what I am trying to achieve
but of course it will not work!

IIf([CountofSurname]>=13,"1") Or IIf([CountofSurname] Between 1 And
18,"1" and "2" ) Or IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3") Or IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4")

In other words if the count is between 1 and 18 then return all the
ones and the twos.

Any help would be appreciate. TIA - R

Remove the "Or"s and nest the IIF statements. Each IIF statement becomes the second argument of the previous statement.
Something like - (air code)

IIf([CountofSurname]>=13,"1",IIf([CountofSurname] Between 1 And
18,"1" and "2",IIf([CountofSurname] Between 1 And 23,"1" and "2"
and "3",IIf([CountofSurname] Between 26 And 32,"1" and "2" and "3"
and "4"))))

It appears the op wants a message like "1 and 2" or "1 and 2 and 3 and
4". I'm not sure if
"1" and "2"
will work. It might be better with
"1 and 2"

The original statement was so flawed I wouldn't have wanted to tackle
it. Kudus for making sense out of it.


You are correct, it should be something like -

IIf([CountofSurname]>=13,"1",IIf([CountofSurname] Between 1 And
18,"1 and 2",IIf([CountofSurname] Between 1 And 23,"1 and 2
and 3",IIf([CountofSurname] Between 26 And 32,"1 and 2 and 3
and 4"))))

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James | last post by:
Hi I am having some trouble getting a asp page to load. Im a noob to the asp side. I have followed knowledege base Article 301305. I am running 2000 adv, IIS 5.0 I have the following...
4
by: Jacek Dziedzic | last post by:
Hi! First of all, I hope my problem is not too loosely tied to the "standard C++" that is the topic of this group. I have some code that exhibits a strange behaviour: on one computer, where I...
0
by: Paul C | last post by:
Hello, everybody. I am having trouble running some of the VS.NET samples, specifically the CarSelector web app, which is very simple. The symptom is that the web controls (drop down listboxes and...
0
by: Alexandre Jaquet | last post by:
Hi does anybody know how to solve my trouble, when I try to create a MS Office project I always got trouble. I can't create office project when I try to create one vs.net restart ... :s
2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
1
by: Jim Bancroft | last post by:
Hi everyone, I'm running into a problem with my ASP.Net application. I've just created a new aspx page which uses some new components of mine that inherit from ServicedComponent and are...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
2
by: JLupear | last post by:
I am having trouble with my code again, I had prepared a question and the code to upload, however I am having trouble posting it, are there limits to the amount of lines you can post? I split it...
0
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
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...

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.