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

IIf statement problem

I'm still kinda new to Access but I keep getting the "you may have entered an operand without an operator" error. My string looks like this:
Expand|Select|Wrap|Line Numbers
  1. = IIf([Asset_Writ_Date] IsNull then
  2. (DateAdd("yyyy",[SOL_Judgment_Limit],[Asset_Judgment_Date])),
  3. or
  4. IIf([Asset_Writ_Date] IsDate then
  5. (DateAdd("yyyy",[SOL_Judgment_Limit],[Asset_Writ_Date]))
  6. End IIf
  7. End IIf
Any help would be much appreciated.
Aug 11 '11 #1

✓ answered by Rabbit

The correct syntax of the IIf() function is
Expand|Select|Wrap|Line Numbers
  1. IIf(boolean expression, value to return if true, value to return if false)
Also, IsNull() and IsDate() are functions. Its parameters need to be enclosed within parentheses.
Expand|Select|Wrap|Line Numbers
  1. IsNull(value)
  2. IsDate(value)
A simpler alternative is to use the Nz function instead of nesting IIf() functions.

2 1831
Rabbit
12,516 Expert Mod 8TB
The correct syntax of the IIf() function is
Expand|Select|Wrap|Line Numbers
  1. IIf(boolean expression, value to return if true, value to return if false)
Also, IsNull() and IsDate() are functions. Its parameters need to be enclosed within parentheses.
Expand|Select|Wrap|Line Numbers
  1. IsNull(value)
  2. IsDate(value)
A simpler alternative is to use the Nz function instead of nesting IIf() functions.
Aug 11 '11 #2
NeoPa
32,556 Expert Mod 16PB
I'm not even able to recognise whether this code is SQL or VBA. Perhaps you should explain what you're trying to do clearly in simple English and we'll see what we can do to help.
Aug 12 '11 #3

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

Similar topics

7
by: Graham James Campbell CS2000 | last post by:
Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user inputted text into some html I am storing in a...
0
by: Gary Bouchard | last post by:
MYSQL Version 4.0.15 Can some anyone tell me what is wrong with the following statement; select bookings.key1,bookings.surname,bookings.firstname,bookings.bookingseqno,bookings.filetype from...
13
by: kieran | last post by:
Hi, I have the following SQL statement which is pulling a few details from a database. As you can see, there is only the one table from which i am creating a temporary copy. The reason I do...
6
by: DLP22192 | last post by:
I have the following single-line if statement that is evaluating true even though it shouldn't. I have never seen this before and I am concerned that this can happen in other areas of my code. ...
1
by: Ian Davies | last post by:
I am using a simple delete statement in my php script (below) $q = "DELETE FROM commenttype WHERE TypeID=".$_POST; the problem is it doesnt delete the whole row it only deletes the text in one...
4
by: bokke | last post by:
Hi, I have a page that has several stories that run on it from a mysql database. Right now I use this code: <img src="Images/NewsPics/<?php echo $row;?>.jpg" border="1"to display the image. ...
5
by: JamesHoward | last post by:
I have a problem with python's asyncore module throwing a bad file descriptor error. The code might be difficult to copy here, but the problem is essentially: The server wants to sever the...
2
by: gool | last post by:
Hi, I am writing this piece of code: $sqlquery="WITH journey (TO_TOWN, STEPS, DISTANCE, WAY) AS (SELECT DISTINCT JNY_FROM_TOWN, 0, 0, CAST('PARIS' AS VARCHAR(MAX)) FROM T_JOURNEY ...
6
by: jephperro | last post by:
Hi there, I'm having a really tough time with a SQL statement and I am wondering if someone is able to help out or point me in the right direction. I have a table of names which can be very...
1
by: Maklar60 | last post by:
I am attempting to execute an INSERT statement on my page but continually get the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Incorrect syntax near '<'. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.