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

Expression with multiple if/then variables

I am working with MS Access 2007, using Windows XP.

I have eights fields in one section of my form. Each one has a combo box
with the following 3 options:

Field1: 2.5, 0, "" (I am using a blank to designate a null value)
Field 2: 2.5, 0, ""
Field 3: 2.5, 0, ""
Field 4: 2.5, 0, ""
Field 5: 10, 0, ""
Field 6: 5, 0, ""
Field 7: 5, 0, ""
Field 8: 5, 0, ""

If a numerical value is chosen, that indicates the task was completed, 0
indicates that it was not, and "null" means that it was not applicable.

(Numerical values in this section sum up to 35)

In essence, each field is weighted differently. Now there are a number of
variations that can happen.

For example, let's say that fields 1 - 7 are applicable & field 8 is not,
BUT field 5 (a value of 10) was not completed, so it was given a "0" zero
value. This changes the total to 20 (adding fields 1,2,3,4,6,7) out of 30,
because field 8 was not applicable and thus given a null value. To get the
percentage, 20/30 = 66.6%.

Yet another example: only fields 7 & 8 were applicable and both were
completed for a total of 10, while fields 1 - 6 were given null values, as they did not apply. I would then need the expression to divide the
10 by 10 (the total value) which then gives me 100%.

Right now I have this in my control source for the control that is calculating the percentage:
=(Nz([Field1],0)+Nz([Field2],0)+Nz([Field3],0)+Nz([Field4],0)+Nz([Field5],0)+Nz([Field6],0)+Nz([Field7],0)+Nz([Field8],0))/35

This obviously only works if they're all selected, as it divides by 35.

My question is how do I get the expression to account for any & all of these
variables?

Should I be looking into the "IIF" function?

HELP!
Mar 14 '07 #1
1 3173
Rabbit
12,516 Expert Mod 8TB
You can use the iif function to build the denominator:
Expand|Select|Wrap|Line Numbers
  1. iif(Field1 Is Null, 0, 2.5) + iif(Field2 Is Null, 0, 2.5) ...
And so on.
Mar 14 '07 #2

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

Similar topics

11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
2
by: Christian Staffe | last post by:
Hi, I would like to check for a partial match between an input string and a regular expression using the Regex class in .NET. By partial match, I mean that the input string could not yet be...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
9
by: Bob Day | last post by:
VS 2003, vb.net , sql msde... I have an application with multiple threads running. Its a telephony application where each thread represents a telephone line. For code that would be the same...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
2
by: comp.lang.php | last post by:
I am trying to replace within the HTML string $html the following: With Where I'm replacing "action=move_image" with "action=<?= $_REQUEST ?>"
21
by: Steven T. Hatton | last post by:
I'm trying to improve my formal understanding of C++. One significant part of that effort involves clarifying my understanding of the vocabulary used to describe the language. This is from the...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
2
by: Immortal Nephi | last post by:
You may have heard diamond shape. You create one base class. One base class has member functions and member variables. You create two derived classes. All member functions and member variables...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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
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
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 project—planning, coding, testing,...

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.