473,394 Members | 2,071 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.

Need Help Writing Query Expression that Includes IsNull Or with dates

I'm trying to have a query return "due by 9/8/14" if the entry in a field is blank or has a date before 9/8/14, or return "valid through (date)" if the date in the field is after 9/8/14. Here's how I've written the expression:

Expand|Select|Wrap|Line Numbers
  1. MedWords=IIf([Grace] IsNull Or <9/8/14, "due 9/8/14", "valid through [Grace]")
What am I doing wrong?
Aug 29 '14 #1
6 1151
Never mind, I figured it out! It works when I wrote it this way:

Expand|Select|Wrap|Line Numbers
  1. IIf(IsNull([Grace]) Or [Grace]<#9/8/14#, "due 9/8/14", "valid through " & [Grace])
Aug 29 '14 #2
NeoPa
32,556 Expert Mod 16PB
Try this :
Expand|Select|Wrap|Line Numbers
  1. MedWords=IIf(Nz([Grace],#1/1/2014#)<#9/8/2014#,'due 9/8/2014','valid through '+[Grace])
Aug 30 '14 #3
Thanks, NeoPa. That didn't work. As I mentioned in my second post, I finally found the right way to do it which was:

Expand|Select|Wrap|Line Numbers
  1. IIf(IsNull([Grace]) Or [Grace]<#9/8/14#, "due 9/8/14", "valid through " & [Grace])
Aug 30 '14 #4
NeoPa
32,556 Expert Mod 16PB
Please share how it didn't work. If all the details we have from you are correct then I fail to see how that were possible.

Your approach certainly should work too - but I wouldn't describe it as the right way. You certainly wouldn't use IsNull() in SQL for preference over [X] Is Null. Other than that I would generally look for a single check rather than two if possible.

I'm very interested to hear how it is that my suggestion failed mind you.
Aug 30 '14 #5
I see that my expression builder was trying autocorrect your expression (by putting MedWords into brackers). When I manually return yours to what you actually wrote, it does work.

Thanks so much.
Aug 30 '14 #6
NeoPa
32,556 Expert Mod 16PB
No problems :-)

Don't forget - your version works also. There is rarely ever only one right answer.
Aug 30 '14 #7

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

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Rolan | last post by:
I created a function module base on a query to provide a group record total for a subform and which is posted to a field on the main form. Everything seems to work fine except that I consistently...
8
by: Dalan | last post by:
Please help - just take a quick look at the function code below. It probably just needs some minor tweaking. The function module is based on an intermediate query to provide a group record...
5
by: deko | last post by:
After developing an MDB in Access 2003 on WS03, then making it into an MDE and deploying it on a WinXP box with Access 2003 installed, I get this error: Function is not available in expressions...
1
by: Don Sealer | last post by:
I have a report that includes 5 different subreports. I'd like to be able to open this report using a date function (Start Date and End Date). I'd like all five subreports to show the data from...
0
by: P.Jaimal | last post by:
Hi, I am trying to make a crosstab query which returns select records between two dates.I have used the 'parameter' statement in SQL for invoking the "enter start date" and "enter end date" input...
3
by: acdevteam | last post by:
Hello Everyone, We are a dev team very new to Access, and so far we have gotten excellent support from this group. We have a question about writing a query. Here is the situation: We have a...
9
by: Alan Mailer | last post by:
Ok, my Access 2002 language writing skills are VERY rusty,. I would know how to do what I need using SQL Server's "Coalesce' function, but I don't have that available to me in the Access 2002...
3
by: Sheldon | last post by:
I have the following query expression - Like Format((!!)) & "/*/" & (! !) which would translate to e.g. 04/*/2007 if someone is running a report for last month. The above expression is part of a...
2
by: Lieven | last post by:
The problem is fairly complex. I have a table where I can add records. These records have several parts. Each record consists of ID, Date, Train Number and many more. I have a form where I can...
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: 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...
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,...

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.