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

What's wrong with this expression?

8
This in a Text Box control on an access report. I get the "wrong number of arguments" message, but what is the correct number of arguments?
Expand|Select|Wrap|Line Numbers
  1. =IIf(([Hours]=4),IIf([MAIL_LOG_TIME])<=#12:00:00 PM#),
  2. ([MAIL_LOG_DATE]&" "&DateAdd("h",4,[MAIL_LOG_TIME]),""))
May 23 '19 #1

✓ answered by ADezii

Your Syntax is incorrect, Copy-N-Paste the following to the Control Source of your Text Box:
Expand|Select|Wrap|Line Numbers
  1. =IIf([Hours]=4,IIf([MAIL_LOG_TIME]<=#12:00:00 PM#,[MAIL_LOG_DATE]+DateAdd("h",4,[MAIL_LOG_TIME]),""),"")

6 1386
Rabbit
12,516 Expert Mod 8TB
Go through the expression and match all the opening parentheses to its closing parentheses
May 23 '19 #2
R1RAY
8
Still not working, wrong number of arguemnts:
Expand|Select|Wrap|Line Numbers
  1. =IIf(([Hours]=4),IIf([MAIL_LOG_TIME])<=#12:00:00 PM#),([MAIL_LOG_DATE])&" "&DateAdd("h",4,([MAIL_LOG_TIME]))
May 23 '19 #3
Rabbit
12,516 Expert Mod 8TB
Because you still haven't matched them up correctly. Show me which opening parentheses you think matches up with which closing parentheses.

Break out the innermost blocks and look at those separately before trying to combine them all together.
May 23 '19 #4
ADezii
8,834 Expert 8TB
Your Syntax is incorrect, Copy-N-Paste the following to the Control Source of your Text Box:
Expand|Select|Wrap|Line Numbers
  1. =IIf([Hours]=4,IIf([MAIL_LOG_TIME]<=#12:00:00 PM#,[MAIL_LOG_DATE]+DateAdd("h",4,[MAIL_LOG_TIME]),""),"")
May 23 '19 #5
R1RAY
8
Thanks, that worked. I am still having trouble counting out the arguments.

Thanks
-ray
May 23 '19 #6
Rabbit
12,516 Expert Mod 8TB
The syntax for iif is this:
Expand|Select|Wrap|Line Numbers
  1. iif(a, b, c)
For any of those variables, you can embed another function, another iif in your example. But you must maintain the same syntax. So if you want to replace b with this:
Expand|Select|Wrap|Line Numbers
  1. iif(x, y, z)
Then you just fully replace b with that. Resulting in this:
Expand|Select|Wrap|Line Numbers
  1. iif(a, iif(x, y, z), c)
You can't just drop random variables and move the parentheses around willy nilly.
May 23 '19 #7

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

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
4
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
5
by: Alexandre Martins | last post by:
Provider=Microsoft.Jet.OLEDB.4.0;UserId=Admin;Password=teste;Data Source=C:\Inetpub\wwwroot\inktoner\dados\db_inktoner.mdb;Persist Security Info=True I can't connect in my database ! whats...
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
1
by: '~=_Slawek_=~' | last post by:
$DOW = (jddayofweek(unixtojd(mktime(1, 1, 1, $month, $day, $year)))+6)%7; $DOW= (jddayofweek(juliantojd($month, $day, $year))+6)%7; The results are supposed to be the same, but they are not....
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
8
by: Martin Jørgensen | last post by:
Hi, "C primer plus" p.382: Suppose we have this declaration: int (*pa); int ar1; int ar2; int **p2;
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
1
by: x40 | last post by:
I try to learn python thru solving some interisting problem, found google trasure hunt, write first program ( but cant find whats wrong). # Unzip the archive, then process the resulting files to...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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,...

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.