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

iif seems to be iiffy!

jimleon
74
Hi guys,
I am using 2 queries (startdate & lastdate) to input some dates to be used as criteria in a 3rd query.

The expression below returns the value of startdate which will be either todays date or some past date. If the returned date is today it should return a null and exit.

expr1: IIf([startdate].[Expr1]=Date(),Null,[Enter 2nd date:ie 01/01/2007])

However it prompts for the [Enter 2nd date:ie 01/01/2007] vaiable even if the test condition is true.!!!!!

Is this a function of the iif statement...

Cheers Jim
Apr 13 '07 #1
6 1616
jimleon
74
OK, I found another thread on this site saying iif evaluates both states regardless of the condition! Dooh.
So does anyone know how to set up a conditional input where the prompt box is only displayed if the criteria is met?

Many thanks in advance.
Apr 13 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Hi Jim

Don't know if this will work but it's worth a try.

expr1: nz(IIf([startdate].[Expr1]=Date(),"",Null),[Enter 2nd date:ie 01/01/2007])

Mary
Apr 13 '07 #3
jimleon
74
Sorry, even with NZ it will still attempt to perform both conditions :o(
Apr 13 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Hi Jim

Don't know if this will work but it's worth a try.

expr1: nz(IIf([startdate].[Expr1]=Date(),"",Null),[Enter 2nd date:ie 01/01/2007])

Mary
Yes but in this case the conditions are "" and Null so will only go to prompt when null returned.
Apr 13 '07 #5
jimleon
74
The iif command will ALWAYS evaluate both options before returning the correct one!

I need a query based conditional input prompt.
Apr 13 '07 #6
NeoPa
32,556 Expert Mod 16PB
The Jet SQL Engine (Any SQL engine really, as far as I know), will always request values for ALL parameters within the SQL, regardless of whether or not they actually affect any of the results.
In this case, this is not an issue with IIf() (Or Nz() etc...). In fact, within SQL, IIf() doesn't actually evaluate both sides as you would expect if using it from within VBA code.
Apr 13 '07 #7

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

Similar topics

4
by: Stub | last post by:
I read the code in a book and it seems not quite right to me. The possible mistake seems in the dummy::getData(). It returns a local pointer, void* data, back to its caller. Am I right about...
0
by: Ray Tayek | last post by:
hi, trying to convert some csv files into xsml and pulling a few hairs out :(. using the files below. a java program will parse the csv and take care of strange names and notes that line breaks in...
1
by: Eric Trav | last post by:
Hello, I am using mozilla and javascript to change the style background color for my select with onfocus() and back to white with onblur(). When i process onfocus(); i have to click on the...
14
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
3
by: HM | last post by:
Hello ! ----------------------------------------------------------------------------- I would like to know why the database seems frozen. - psql can access to database on the database server...
8
by: Brendan | last post by:
There must be an easy way to do this: For classes that contain very simple data tables, I like to do something like this: class Things(Object): def __init__(self, x, y, z): #assert that x,...
9
by: Russell Warren | last post by:
After some digging it seems that python does not have any equivalent to C's #if directives, and I don't get it... For example, I've got a bit of python 2.3 code that uses...
5
by: Eric_Dexter | last post by:
I was trying to add this to my project but I must be missing some includes or there is a serius error somewhere Anthra Norell wrote:
25
by: Norman Diamond | last post by:
I think the current version of _vsnwprintf_s is broken, in ordinary Windows. I'm not completely sure yet but it looks like this breakage is worse than previously known Windows CE breakage of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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...

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.