473,382 Members | 1,749 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,382 software developers and data experts.

Is there any way this query can be shortened?

I have an expression which is used in a form to change a text box to
either read "Action" or "No Action", based on the state of a series of
12 check boxes and three text boxes.

I want to use the same expression in a query (on which a report is
based), but when I try and paste the expression into the query I get
the error

"The text is too long to be edited".

Is there any way this expression can be shortened, for example by
using the "or" statement?

Many thanks!

Joseph

-------------------------

=IIf([Eva1Due]<Date()+10 And [Eva1Received]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]
=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=True And [Eva1Client]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]
=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=True And [Eva2Client]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]
=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=True And [Eva3Client]=False,"Action","No
Action"))))))))))))
--------------
Nov 12 '08 #1
3 1544
I managed to shorten it by changing the name of my fields!
Nov 12 '08 #2

"Joseph" <jo********@gmail.comwrote in message
news:92**********************************@z6g2000p re.googlegroups.com...
I have an expression which is used in a form to change a text box to
either read "Action" or "No Action", based on the state of a series of
12 check boxes and three text boxes.

I want to use the same expression in a query (on which a report is
based), but when I try and paste the expression into the query I get
the error

"The text is too long to be edited".

Is there any way this expression can be shortened, for example by
using the "or" statement?

Many thanks!

Joseph

-------------------------

=IIf([Eva1Due]<Date()+10 And [Eva1Received]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]
=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=True And [Eva1Client]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]
=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=True And [Eva2Client]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]
=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=True And [Eva3Client]=False,"Action","No
Action"))))))))))))
--------------
Only time you show "No Action" is when all the check boxes are true. If you
do a mathematical OR of all the check boxes, True only occurs if all are
true.

=IIF([Eva3Due]<date()+10 and Not ([Eva1Receive] or [Eva1Check] or
[Eva1Sales] or [Eva1Client] or [Eva2Received] or [Eva2Check] or [Eva2Sales]
or [Eva2Client] or [Eva3Receive] or [Eva3Check] or [Eva3Sales] or
[Eva3Client]),"Action","No Action")


Nov 12 '08 #3

"paii, Ron" <no**@no.comwrote in message news:gf**********@aioe.org...
>
"Joseph" <jo********@gmail.comwrote in message
news:92**********************************@z6g2000p re.googlegroups.com...
I have an expression which is used in a form to change a text box to
either read "Action" or "No Action", based on the state of a series of
12 check boxes and three text boxes.

I want to use the same expression in a query (on which a report is
based), but when I try and paste the expression into the query I get
the error

"The text is too long to be edited".

Is there any way this expression can be shortened, for example by
using the "or" statement?

Many thanks!

Joseph

-------------------------

=IIf([Eva1Due]<Date()+10 And [Eva1Received]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]
=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=False,"Action",
IIf([Eva1Due]<Date()+10 And [Eva1Received]=True And [Eva1Check]=True
And [Eva1Sales]=True And [Eva1Client]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]
=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=False,"Action",
IIf([Eva2Due]<Date()+10 And [Eva2Received]=True And [Eva2Check]=True
And [Eva2Sales]=True And [Eva2Client]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]
=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=False,"Action",
IIf([Eva3Due]<Date()+10 And [Eva3Received]=True And [Eva3Check]=True
And [Eva3Sales]=True And [Eva3Client]=False,"Action","No
Action"))))))))))))
--------------

Only time you show "No Action" is when all the check boxes are true. If
you
do a mathematical OR of all the check boxes, True only occurs if all are
true.

=IIF([Eva3Due]<date()+10 and Not ([Eva1Receive] or [Eva1Check] or
[Eva1Sales] or [Eva1Client] or [Eva2Received] or [Eva2Check] or
[Eva2Sales]
or [Eva2Client] or [Eva3Receive] or [Eva3Check] or [Eva3Sales] or
[Eva3Client]),"Action","No Action")

Sorry, I got it backwards, replace the ORs with AND.

=IIF([Eva3Due]<date()+10 and ([Eva1Receive] and [Eva1Check] and [Eva1Sales]
and [Eva1Client] and [Eva2Received] and [Eva2Check] and [Eva2Sales] and
[Eva2Client] and [Eva3Receive] and [Eva3Check] and [Eva3Sales] and
[Eva3Client]),"No Action","Action")

Nov 12 '08 #4

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

Similar topics

13
by: lucanos | last post by:
Hey All, Just wondering whether there is an abbreviated "If - Then - Else" format in PHP, much like that possible in JavaScript. JavaScript allows an abbreviated version in the following...
3
by: webdev | last post by:
Hi, Code below dynamically adds an input box to a form, creating a new name attribute as it goes... (many thanks to Martin Honnen for getting me this far ;0) Problem is - in IE5.5 only the first...
8
by: Bshealey786 | last post by:
Okay im doing my final project for my first computer science class(its my major, so it will be my first of many), but anyway im a beginner so im not to great with C++ yet. Anyway this is the error...
3
by: Torrent | last post by:
When Trying to Load an XSLT File with the XslTransform i got a rather annoying Exception being thrown "System.Xml.XPath.XPathException: XsltContext is needed for this query because of an unknown...
9
by: MLH | last post by:
Select Case Me.OpenArgs Case "frmVehicleEntryForm" Forms!!.Requery Case "frmEditTowedVehicleList" Forms!!.Requery End Select Me.OpenArgs is the name of the calling form. There are only two...
14
by: ThazKool | last post by:
I want to see if this code works the way it should on a Big-Endian system. Also if anyone has any ideas on how determine this at compile-time so that I use the right decoding or encoding...
1
by: sala | last post by:
HI THERE, the code of the "removespaces" function is 100% CORRECT but it doesn't return the write answer, maybe there is a mistake in the main function: #include<stdio.h> void RemoveSpaces(char...
8
by: Aereshaa | last post by:
For some reason, when I compile this code: int main(){ char* a = malloc(5); long* l = (*long) a; } //I shortened it to isolate the problem. I get this error: error.c:3: error: expected...
3
by: r.e.s. | last post by:
Can the following program be shortened? ... def h(n,m): E=n, while (E!=())*m>0:n=h(n+1,m-1);E=E+(E>0)*(E-1,)*n return n h(9,9) Note: Although it halts eventually in principle, this program...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.